/* ==========================================================================
   BMV Catalogo - estilos. Mismos tokens y paleta azul pastel de oficina_privada.
   Mobile-first: estilos base = movil; @media (min-width) amplia.
   ========================================================================== */
:root {
  --primary-color: #3d7bd6;
  --primary-dark: #2d6bb6;
  --secondary-color: #5a9eff;
  --accent-color: #7db3ff;
  --success-color: #187a42;
  --warning-color: #8a5a0b;
  --danger-color: #c0392b;
  --info-color: #0f7a66;
  --light-bg: #f0f7ff;
  --white: #ffffff;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb; --gray-300: #d1d5db;
  --gray-400: #9ca3af; --gray-500: #6b7280; --gray-600: #4b5563; --gray-700: #374151;
  --gray-800: #1f2937; --gray-900: #111827;
  --primary-soft: #e3eefc;
  --success-soft: #e6f6ed; --warning-soft: #fdf3e0; --danger-soft: #fbe9e7; --info-soft: #e1f5f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
  --border-radius: .5rem; --border-radius-lg: .75rem; --border-radius-xl: 1rem;
  --sidebar-w: 15.5rem;
  --topbar-h: 3.5rem;
  --focus: 0 0 0 3px rgb(61 123 214 / .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--light-bg); color: var(--gray-800); line-height: 1.55; font-size: 1rem;
}
img, video, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; color: var(--gray-900); }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--primary-dark); }
a:hover { color: var(--primary-color); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.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; }
.muted { color: var(--gray-500); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
.nowrap { white-space: nowrap; }
.right { margin-left: auto; }
[hidden] { display: none !important; }

.icon { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex: none; }

.skip-link { position: absolute; left: .5rem; top: -4rem; background: var(--primary-dark); color: #fff; padding: .6rem 1rem; border-radius: var(--border-radius); z-index: 100; }
.skip-link:focus { top: .5rem; }

/* ---------- Layout ---------- */
.shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem; background: var(--white); border-bottom: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--primary-dark); text-decoration: none; }
.brand-mark { width: 2rem; height: 2rem; border-radius: .6rem; background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); color: #fff; display: grid; place-items: center; font-size: .85rem; letter-spacing: .02em; }
.brand small { display: block; font-weight: 600; color: var(--gray-500); font-size: .7rem; line-height: 1; }
.menu-btn { min-width: 2.75rem; min-height: 2.75rem; }
.sidebar {
  position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 25; background: var(--white); padding: 1rem;
  transform: translateX(-100%); transition: transform .2s ease; overflow-y: auto; border-right: 1px solid var(--gray-200);
  max-width: 20rem; width: 85vw;
}
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: var(--border-radius); min-height: 2.75rem;
  color: var(--gray-700); text-decoration: none; font-weight: 600;
}
.nav a:hover { background: var(--primary-soft); color: var(--primary-dark); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-dark); box-shadow: inset 3px 0 0 var(--primary-color); }
.nav-sep { margin: 1rem .8rem .35rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-500); font-weight: 700; }
.userbox { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--gray-200); font-size: .9rem; }
.userbox strong { display: block; }
.main { padding: 1rem; max-width: 100%; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1rem; }
.page-head p { margin: 0; color: var(--gray-500); }

@media (min-width: 1024px) {
  .topbar { display: none; }
  .sidebar { transform: none; inset: 0 auto 0 0; width: var(--sidebar-w); max-width: none; box-shadow: none; padding-top: 1.25rem; }
  .sidebar .brand { margin-bottom: 1.25rem; padding: 0 .5rem; }
  .main { margin-left: var(--sidebar-w); padding: 1.5rem 2rem 3rem; }
  .menu-only { display: none; }
}
@media (max-width: 1023.98px) { .sidebar .brand { display: none; } }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; padding: .55rem 1rem;
  border: 1px solid transparent; border-radius: var(--border-radius); font: inherit; font-weight: 700; cursor: pointer;
  text-decoration: none; background: var(--primary-dark); color: #fff; transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: #245a9c; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-ghost { background: var(--white); color: var(--primary-dark); border-color: var(--gray-300); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn-danger { background: var(--danger-color); }
.btn-danger:hover { background: #a93226; }
.btn-success { background: var(--success-color); }
.btn-success:hover { background: #125f35; }
.btn-sm { min-height: 2.25rem; padding: .3rem .7rem; font-size: .9rem; }
.btn-icon { padding: .5rem; min-width: 2.75rem; }
.btn-link { background: none; border: 0; color: var(--primary-dark); padding: 0; font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

label, .label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .3rem; color: var(--gray-700); }
.hint { font-weight: 400; color: var(--gray-500); font-size: .82rem; }
input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 2.75rem; padding: .55rem .75rem; font: inherit; color: var(--gray-900); background: var(--white);
  border: 1px solid var(--gray-300); border-radius: var(--border-radius); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: var(--gray-400); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: var(--focus); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--gray-100); color: var(--gray-600); }
.is-invalid { border-color: var(--danger-color) !important; }
.field-error { color: var(--danger-color); font-size: .85rem; margin-top: .25rem; font-weight: 600; }
.field { margin-bottom: 1rem; }
.row { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .row.cols-2 { grid-template-columns: 1fr 1fr; } .row.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }
.check { display: flex; align-items: flex-start; gap: .6rem; font-weight: 600; min-height: 2.25rem; padding: .3rem 0; cursor: pointer; }
.check input { width: 1.2rem; height: 1.2rem; margin-top: .2rem; accent-color: var(--primary-color); flex: none; }
.check-group { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }

/* ---------- Tarjetas, badges, alertas ---------- */
.card { background: var(--white); border-radius: var(--border-radius-lg); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--gray-100); color: var(--gray-700); white-space: nowrap; }
.badge-sin_catalogar { background: var(--gray-100); color: var(--gray-600); }
.badge-en_proceso { background: var(--warning-soft); color: var(--warning-color); }
.badge-revisado { background: var(--info-soft); color: var(--info-color); }
.badge-publicado { background: var(--success-soft); color: var(--success-color); }
.badge-info { background: var(--primary-soft); color: var(--primary-dark); }
.badge-warn { background: var(--warning-soft); color: var(--warning-color); }
.badge-danger { background: var(--danger-soft); color: var(--danger-color); }
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--border-radius); margin-bottom: 1rem; border: 1px solid transparent; font-weight: 600; }
.alert-ok { background: var(--success-soft); color: #145c34; border-color: #b8e2c9; }
.alert-error { background: var(--danger-soft); color: #8e2a1f; border-color: #f1c1bb; }
.alert-warn { background: var(--warning-soft); color: #7a4d08; border-color: #f0d9a8; }
.alert-info { background: var(--primary-soft); color: #1f4a85; border-color: #bcd3f3; }
.flash { position: sticky; top: calc(var(--topbar-h) + .5rem); z-index: 20; }
@media (min-width: 1024px) { .flash { top: .75rem; } }

/* ---------- Dashboard ---------- */
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--white); border-radius: var(--border-radius-lg); padding: .9rem 1rem; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; border-top: 4px solid var(--gray-300); }
a.stat:hover { box-shadow: var(--shadow-md); }
.stat b { display: block; font-size: 1.8rem; font-weight: 800; line-height: 1.1; color: var(--gray-900); }
.stat span { color: var(--gray-500); font-size: .85rem; font-weight: 700; }
.stat.en_proceso { border-color: var(--warning-color); } .stat.revisado { border-color: var(--info-color); }
.stat.publicado { border-color: var(--success-color); } .stat.pend { border-color: var(--secondary-color); }
.bar { display: flex; height: .7rem; border-radius: 999px; overflow: hidden; background: var(--gray-200); min-width: 6rem; }
.bar > i { display: block; height: 100%; }
.bar .s-en_proceso { background: #f0b04a; } .bar .s-revisado { background: #38b29a; } .bar .s-publicado { background: var(--success-color); }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 1100px) { .grid-2 { grid-template-columns: 3fr 2fr; } }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.timeline li { padding-left: .9rem; border-left: 3px solid var(--primary-soft); font-size: .92rem; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--border-radius-lg); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: .6rem .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--gray-200); }
th { background: var(--gray-50); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); white-space: nowrap; }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Catalogo (listado) ---------- */
.filters { display: grid; gap: .75rem; background: var(--white); border-radius: var(--border-radius-lg); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
@media (min-width: 768px) { .filters { grid-template-columns: 2fr repeat(3, 1fr); align-items: end; } .filters .wide { grid-column: 1 / -1; } }
.filters .field { margin: 0; }
.filter-actions { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; }
.result-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.seg { display: inline-flex; border: 1px solid var(--gray-300); border-radius: var(--border-radius); overflow: hidden; background: var(--white); }
.seg a, .seg button { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; min-height: 2.5rem; border: 0; background: none; font: inherit; font-weight: 700; color: var(--gray-600); text-decoration: none; cursor: pointer; }
.seg a[aria-current="true"], .seg button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary-dark); }
.items-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); }
.tile { display: flex; flex-direction: column; background: var(--white); border-radius: var(--border-radius-lg); box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: inherit; }
.tile-media { position: relative; aspect-ratio: 4 / 3; background: var(--primary-soft); display: grid; place-items: center; color: var(--primary-color); overflow: hidden; }
.tile-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-media .icon { width: 2.6rem; height: 2.6rem; stroke-width: 1.4; }
.tile-flags { position: absolute; left: .4rem; top: .4rem; display: flex; gap: .3rem; }
.tile-body { padding: .6rem .75rem .75rem; display: grid; gap: .25rem; }
.tile-code { font-size: .72rem; color: var(--gray-500); font-weight: 700; letter-spacing: .02em; }
.tile-title { font-weight: 700; font-size: .92rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-title.vacio { color: var(--gray-500); font-style: italic; font-weight: 600; }
.pager { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: center; margin-top: 1.25rem; }

/* ---------- Editor ---------- */
.editor-bar {
  position: sticky; top: var(--topbar-h); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  background: var(--white); border-bottom: 1px solid var(--gray-200); padding: .6rem 1rem; margin: -1rem -1rem 1rem; box-shadow: var(--shadow-sm);
}
@media (min-width: 1024px) { .editor-bar { top: 0; margin: -1.5rem -2rem 1.25rem; padding: .7rem 2rem; } }
.editor-title { min-width: 0; flex: 1 1 14rem; }
.editor-title .code { font-size: .78rem; font-weight: 700; color: var(--gray-500); }
.editor-title h1 { font-size: 1.05rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.save-state { font-size: .85rem; font-weight: 700; color: var(--gray-500); min-width: 8rem; }
.save-state.dirty { color: var(--warning-color); } .save-state.ok { color: var(--success-color); } .save-state.err { color: var(--danger-color); }
.editor { display: grid; gap: 1rem; }
@media (min-width: 1180px) { .editor { grid-template-columns: minmax(24rem, 5fr) minmax(0, 6fr); align-items: start; } .viewer-col { position: sticky; top: 5rem; } }
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--gray-200); margin-bottom: .9rem; }
.tab { background: none; border: 0; padding: .6rem .9rem; font: inherit; font-weight: 700; color: var(--gray-500); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; min-height: 2.75rem; display: inline-flex; gap: .4rem; align-items: center; }
.tab[aria-selected="true"] { color: var(--primary-dark); border-color: var(--primary-color); }
.viewer { background: var(--gray-900); border-radius: var(--border-radius-lg); overflow: hidden; display: grid; place-items: center; min-height: 14rem; max-height: 70vh; position: relative; }
.viewer img { max-width: 100%; max-height: 70vh; object-fit: contain; display: block; cursor: zoom-in; }
.viewer img.zoom { cursor: zoom-out; max-width: none; max-height: none; }
.viewer.scroll { display: block; overflow: auto; }
.viewer video { width: 100%; max-height: 70vh; background: #000; }
.viewer audio { width: 92%; margin: 2rem 0; }
.viewer iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.viewer .nofile { color: #cbd5e1; text-align: center; padding: 2rem 1rem; }
.viewer .nofile .icon { width: 3rem; height: 3rem; stroke-width: 1.3; display: block; margin: 0 auto .5rem; }
.file-meta { margin: .9rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; font-size: .88rem; }
.file-meta dt { color: var(--gray-500); font-weight: 700; } .file-meta dd { margin: 0; word-break: break-word; }
.dup-list { margin: .25rem 0 0; padding-left: 1.1rem; font-size: .82rem; color: var(--gray-600); word-break: break-word; }

fieldset.sec { border: 0; margin: 0; padding: 0; min-width: 0; }
.sec + .sec { margin-top: 1rem; }
.sec-head { width: 100%; display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.sec-head h2 { margin: 0; font-size: 1.05rem; }
.sec-num { width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; font-size: .85rem; font-weight: 800; flex: none; }
legend { padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: .4rem; border: 1px solid var(--gray-300); border-radius: var(--border-radius); background: var(--white); min-height: 2.75rem; align-items: center; position: relative; }
.chips:focus-within { border-color: var(--primary-color); box-shadow: var(--focus); }
.chips input { flex: 1 1 8rem; min-width: 6rem; border: 0 !important; box-shadow: none !important; min-height: 2rem; padding: .25rem .4rem; background: transparent; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .3rem .15rem .65rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; font-size: .88rem; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.chip button:hover { background: rgb(0 0 0 / .08); }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 15; margin-top: 2px; background: var(--white); border: 1px solid var(--gray-300); border-radius: var(--border-radius); box-shadow: var(--shadow-lg); list-style: none; padding: .25rem; max-height: 14rem; overflow: auto; }
.suggest li { padding: .5rem .7rem; border-radius: .35rem; cursor: pointer; min-height: 2.25rem; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--primary-soft); }
.person-row { display: grid; gap: .4rem; grid-template-columns: 1fr; align-items: center; margin-bottom: .5rem; position: relative; }
@media (min-width: 640px) { .person-row { grid-template-columns: 1fr 10rem auto; } }
.person-row .wrap { position: relative; }

/* Vista previa tipo portal */
.preview-note { font-size: .85rem; color: var(--gray-500); margin-bottom: .75rem; }
.pv-card { background: var(--white); border-radius: var(--border-radius-xl); box-shadow: var(--shadow-md); overflow: hidden; border: 1px solid var(--gray-200); }
.pv-media { background: var(--primary-soft); aspect-ratio: 16 / 10; display: grid; place-items: center; color: var(--primary-color); overflow: hidden; }
.pv-media img { width: 100%; height: 100%; object-fit: cover; }
.pv-media .icon { width: 3.2rem; height: 3.2rem; stroke-width: 1.3; }
.pv-body { padding: 1rem 1.15rem 1.15rem; display: grid; gap: .55rem; }
.pv-kicker { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pv-title { font-size: 1.25rem; font-weight: 800; margin: 0; color: var(--gray-900); }
.pv-title.vacio { color: var(--gray-400); font-style: italic; }
.pv-date { font-weight: 700; color: var(--primary-dark); display: flex; gap: .4rem; align-items: center; }
.pv-desc { margin: 0; color: var(--gray-700); }
.pv-desc.vacio { color: var(--gray-400); font-style: italic; }
.pv-line { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; font-size: .9rem; color: var(--gray-600); }
.pv-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.pv-tags span { font-size: .8rem; font-weight: 700; color: var(--gray-600); background: var(--gray-100); padding: .1rem .55rem; border-radius: 999px; }
.pv-foot { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: center; border-top: 1px solid var(--gray-200); padding-top: .7rem; font-size: .82rem; color: var(--gray-500); }
.pv-cta { background: var(--warning-soft); color: #7a4d08; border-radius: var(--border-radius); padding: .6rem .8rem; font-weight: 700; font-size: .9rem; display: flex; gap: .5rem; align-items: center; }
.pv-ficha dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: .5rem 0 0; font-size: .92rem; }
.pv-ficha dt { color: var(--gray-500); font-weight: 700; } .pv-ficha dd { margin: 0; }
.checklist { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .35rem; }
.checklist h3 { margin: .8rem 0 .3rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); }
.checklist li { display: flex; gap: .55rem; align-items: flex-start; font-size: .92rem; font-weight: 600; }
.checklist .ok { color: var(--success-color); } .checklist .fail { color: var(--danger-color); } .checklist .warn { color: var(--warning-color); } .checklist .na { color: var(--gray-400); }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; font-size: .88rem; }
.history li { padding-left: .8rem; border-left: 3px solid var(--primary-soft); }

/* ---------- Login / pagina simple ---------- */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: linear-gradient(160deg, var(--light-bg), #dbe9ff); }
.bare-card { width: 100%; max-width: 27rem; background: var(--white); border-radius: var(--border-radius-xl); box-shadow: var(--shadow-lg); padding: 1.75rem; }
.bare-card.wide { max-width: 38rem; }
.bare-card .brand { margin-bottom: 1.25rem; }
.honey { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 80; display: grid; gap: .5rem; max-width: min(24rem, calc(100vw - 2rem)); }
.toast { background: var(--gray-900); color: #fff; padding: .7rem 1rem; border-radius: var(--border-radius); box-shadow: var(--shadow-lg); font-weight: 600; display: flex; gap: .6rem; align-items: flex-start; animation: toast-in .2s ease; }
.toast.ok { background: #145c34; } .toast.err { background: #8e2a1f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

dialog { border: 0; border-radius: var(--border-radius-lg); box-shadow: var(--shadow-lg); padding: 1.25rem; max-width: 28rem; width: calc(100vw - 2rem); }
dialog::backdrop { background: rgb(17 24 39 / .55); }
details.inline-edit > summary { cursor: pointer; font-weight: 700; color: var(--primary-dark); min-height: 2.25rem; display: inline-flex; align-items: center; gap: .3rem; }
details.inline-edit[open] > summary { margin-bottom: .6rem; }
.clave-box { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; background: var(--gray-900); color: #fff; padding: .6rem .9rem; border-radius: var(--border-radius); display: inline-block; user-select: all; }

@media print { .sidebar, .topbar, .editor-bar, .btn { display: none !important; } .main { margin: 0; } }

/* ---------- Utilidades (sin estilos inline por el CSP) ---------- */
.w-full { width: 100%; } .mb-1 { margin-bottom: 1rem; } .mt-1 { margin-top: 1rem; } .mt-05 { margin-top: .5rem; }
.mw-form { max-width: 34rem; } .flat { box-shadow: none; } .ta-right { text-align: right; } .minw-8 { min-width: 8rem; }
.m-tight { margin: .6rem 0 0; } .m-userlink { margin: .6rem 0 .4rem; } .list-plain { margin: 0; padding-left: 1.1rem; }
.fs-plain { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.items-grid { list-style: none; margin: 0; padding: 0; }
.inline-form { display: inline-block; margin: 0 .25rem .25rem 0; }
.pre { white-space: pre-wrap; word-break: break-word; }
.bar > i { width: 0; }

/* ---------- Buscador global, accesos rapidos, resultados agrupados ---------- */
.hero-search { display: flex; gap: .6rem; margin-bottom: 1rem; }
.hero-search input[type="search"] { flex: 1; min-height: 3.25rem; font-size: 1.05rem; padding: .7rem 1rem; border-radius: var(--border-radius-lg); box-shadow: var(--shadow); }
.hero-search .btn { min-height: 3.25rem; padding: 0 1.25rem; }
@media (max-width: 520px) { .hero-search { flex-direction: column; } }
.side-search { margin-bottom: .75rem; }
.side-search input { min-height: 2.5rem; font-size: .9rem; }
.shortcuts { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.shortcut { display: flex; flex-direction: column; justify-content: center; gap: .1rem; min-height: 4.2rem; padding: .7rem .9rem; background: var(--white); border-radius: var(--border-radius-lg); box-shadow: var(--shadow); text-decoration: none; color: var(--primary-dark); font-weight: 700; border-left: 4px solid var(--primary-color); transition: box-shadow .15s, transform .15s; }
.shortcut:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: var(--primary-dark); }
.shortcut strong { font-size: 1.5rem; line-height: 1.1; color: var(--gray-900); }
.shortcut span { font-size: .88rem; color: var(--gray-600); }
.result-summary { font-size: 1.05rem; margin-bottom: 1rem; }
.group { margin-bottom: 1.75rem; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; border-bottom: 2px solid var(--primary-soft); padding-bottom: .3rem; }
.group-head h2 { margin: 0; }
.related p { margin: .3rem 0; }
.related .label { display: inline; }
.chip-link { display: inline-block; padding: .15rem .7rem; margin: .1rem .1rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); text-decoration: none; font-weight: 700; font-size: .9rem; }
.chip-link:hover { background: var(--accent-color); color: var(--gray-900); }

/* Boton nativo de "elegir archivo" con el estilo del sistema */
input[type="file"] { width: 100%; padding: .5rem; border: 1px dashed var(--gray-300); border-radius: var(--border-radius); background: var(--gray-50); font: inherit; }
input[type="file"]::file-selector-button { margin-right: .75rem; padding: .5rem .9rem; border: 1px solid var(--gray-300); border-radius: var(--border-radius); background: var(--white); color: var(--primary-dark); font: inherit; font-weight: 700; cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--primary-soft); }

/* ---------- Vista previa de documentos y estados vacios ---------- */
.viewer.doc { background: #e4e7ec; border: 1px solid var(--gray-200); display: block; max-height: 75vh; overflow: auto; place-items: stretch; }
.docview { padding: .9rem; color: var(--gray-700); }
.doc-text { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .93rem; line-height: 1.6; margin: 0; }
.doc-note { color: var(--gray-500); font-size: .85rem; margin: .75rem 0 0; }
.doc-sheet h3 { margin: 0 0 .4rem; }
.doc-sheet + .doc-sheet { margin-top: 1rem; }
.doc-table-wrap { overflow: auto; }
.doc-table { font-size: .8rem; border-collapse: collapse; }
.doc-table td { border: 1px solid var(--gray-200); padding: .25rem .5rem; white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }
.empty h2 { margin-bottom: .5rem; }
.tile-media .play { position: absolute; right: .5rem; bottom: .5rem; width: 2rem; height: 2rem; padding: .4rem; border-radius: 50%; background: rgb(17 24 39 / .7); color: #fff; }
.tile-media .play .icon { width: 100%; height: 100%; stroke-width: 2; }
.doc-img { display: block; max-width: 100%; height: auto; margin: .5rem 0; border: 1px solid var(--gray-200); border-radius: var(--border-radius); background: #fff; }

/* Visor de imagen del editor: mano para desplazarse */
.viewer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.viewer img { cursor: zoom-in; }
.viewer.scroll img.zoom { cursor: grab; user-select: none; -webkit-user-drag: none; touch-action: none; }
.viewer.scroll.arrastrando img.zoom { cursor: grabbing; }
.viewer.scroll { scrollbar-width: thin; }

.tile-snip { font-size: .76rem; line-height: 1.35; color: var(--gray-600); border-left: 3px solid var(--primary-soft); padding-left: .45rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Transcripcion editable (entrevistas) */
.trans-lista { max-height: 28rem; overflow: auto; border: 1px solid var(--gray-200); border-radius: var(--border-radius); background: var(--gray-50); }
.trans-fila { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: .5rem; padding: .4rem .5rem; border-bottom: 1px solid var(--gray-200); align-items: start; }
.trans-hora { border: 1px solid var(--gray-300); background: var(--white); border-radius: .4rem; font: inherit; font-weight: 800; font-size: .82rem; color: var(--primary-dark); cursor: pointer; min-height: 2.25rem; font-variant-numeric: tabular-nums; }
.trans-hora:hover { background: var(--primary-soft); }
.trans-texto { min-height: 2.25rem; padding: .35rem .5rem; resize: vertical; line-height: 1.4; font-size: .93rem; }
.trans-texto.editada { border-color: var(--warning-color); background: var(--warning-soft); }
