/* Documental — identidad: archivo de expedientes. Tinta, papel, manila y sellos de registro. */
:root {
  --tinta: #1B2F4B;
  --tinta-2: #24405F;
  --tinta-3: #34557A;
  --papel: #F4F6F3;
  --blanco: #FFFFFF;
  --grafito: #252A31;
  --gris: #5D6672;
  --gris-2: #8B939D;
  --linea: #DCE1DD;
  --linea-2: #EBEEEA;
  --manila: #E9DDB8;
  --manila-2: #F6F0DC;
  --verde: #2F7D5B;
  --azul: #3C64A8;
  --ambar: #9A6B12;
  --lacre: #A23B2A;
  --violeta: #6A4C93;
  --foco: #3C64A8;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--sans); color: var(--grafito); background: var(--papel); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--azul); }
:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 272px 1fr; height: 100vh; }
.side { background: var(--tinta); color: #DCE4EE; display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 6px; background: var(--manila); display: grid; place-items: center; }
.brand-name { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: .2px; }
.side-nav { padding: 4px 10px; }
.side-nav a, .tree-row { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 5px; color: #DCE4EE; text-decoration: none; font-size: 14px; cursor: pointer; }
.side-nav a:hover, .tree-row:hover { background: var(--tinta-2); }
.side-nav a.on, .tree-row.on { background: var(--manila); color: var(--tinta); font-weight: 600; }
.side-nav .count { margin-left: auto; font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
.side-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; font-size: 12px; color: #9FB0C4; font-weight: 600; }
.side-h button { background: none; border: 0; color: #C9D5E3; cursor: pointer; padding: 2px 6px; border-radius: 4px; font-size: 18px; line-height: 1; }
.side-h button:hover { background: var(--tinta-2); color: #fff; }
.tree { flex: 1; overflow: auto; padding: 0 10px 12px; min-height: 0; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.tree > ul { padding-left: 0; }
.tree-row { padding: 4px 8px; }
.tree-row .tw { width: 16px; height: 16px; flex: none; display: grid; place-items: center; opacity: .7; border: 0; background: none; padding: 0; color: inherit; cursor: pointer; }
.tree-row .tw svg { transition: transform .15s; }
.tree-row.open .tw svg { transform: rotate(90deg); }
.tree-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row.drop { background: var(--tinta-3); outline: 1px dashed var(--manila); }
.side-foot { border-top: 1px solid var(--tinta-2); padding: 12px 16px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--tinta-3); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; flex: none; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { color: #9FB0C4; font-size: 12px; }
.side-foot button { background: none; border: 1px solid var(--tinta-3); color: #DCE4EE; border-radius: 5px; padding: 4px 8px; cursor: pointer; font-size: 12px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--blanco); border-bottom: 1px solid var(--linea); }
.top .menu-btn { display: none; }
.searchbox { flex: 1; max-width: 720px; position: relative; }
.searchbox input { width: 100%; height: 40px; border: 1px solid var(--linea); background: var(--papel); border-radius: 20px; padding: 0 16px 0 40px; outline: none; }
.searchbox input:focus { border-color: var(--azul); background: #fff; box-shadow: 0 0 0 3px rgba(60, 100, 168, .15); }
.searchbox svg { position: absolute; left: 14px; top: 12px; color: var(--gris-2); }
.mode-banner { font-size: 12px; background: var(--manila-2); color: #6B5420; border: 1px solid var(--manila); padding: 4px 10px; border-radius: 4px; white-space: nowrap; }
.content { flex: 1; overflow: auto; padding: 20px 24px 40px; min-height: 0; position: relative; }

/* ---------- Cabecera de vista ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--gris); margin-bottom: 4px; }
.crumbs a { color: var(--gris); text-decoration: none; }
.crumbs a:hover { color: var(--azul); text-decoration: underline; }
.crumbs .sep { color: var(--gris-2); }
.vhead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.vhead h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.15; margin: 0; flex: 1; min-width: 200px; }
.vhead .sub { color: var(--gris); font-size: 14px; margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Botones y formularios ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--linea); background: var(--blanco); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--grafito); }
.btn:hover { border-color: var(--gris-2); }
.btn.primary { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.btn.primary:hover { background: var(--tinta-2); }
.btn.ok { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn.danger { color: var(--lacre); border-color: #E4C3BD; }
.btn.danger.solid { background: var(--lacre); color: #fff; border-color: var(--lacre); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--linea-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 5px; cursor: pointer; color: var(--gris); }
.icon-btn:hover { background: var(--linea-2); color: var(--grafito); }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; font-weight: 600; color: var(--gris); margin-bottom: 4px; }
.in, select.in, textarea.in { width: 100%; height: 38px; border: 1px solid var(--linea); border-radius: var(--r); padding: 0 10px; background: #fff; outline: none; }
textarea.in { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; }
.in:focus { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(60, 100, 168, .15); }
.in.ro { background: var(--papel); }
.hint { font-size: 12px; color: var(--gris); margin-top: 3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin-bottom: 10px; }
.err { color: var(--lacre); font-size: 13px; margin: 6px 0; }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filters select, .filters input { height: 32px; border: 1px solid var(--linea); border-radius: 16px; padding: 0 12px; background: #fff; font-size: 13px; }
.filters .lbl { font-size: 13px; color: var(--gris); }

/* ---------- Tabla de documentos ---------- */
.list { background: var(--blanco); border: 1px solid var(--linea); border-radius: 8px; overflow: hidden; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--gris); padding: 10px 14px; border-bottom: 1px solid var(--linea); background: #FAFBF9; white-space: nowrap; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--linea-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover { background: #F8FAF7; }
table.t tbody tr.sel { background: var(--manila-2); }
.t .name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.t .name b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; }
.t .name small { color: var(--gris); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.t .num { font-variant-numeric: tabular-nums; color: var(--gris); white-space: nowrap; }
.snip { font-size: 12.5px; color: var(--gris); margin-top: 2px; }
.snip mark { background: var(--manila); color: var(--grafito); padding: 0 1px; border-radius: 2px; }
.ficon { width: 32px; height: 38px; flex: none; position: relative; border-radius: 3px 8px 3px 3px; background: #EEF1EC; border: 1px solid var(--linea); display: grid; place-items: end center; padding-bottom: 4px; font-size: 8.5px; font-weight: 700; color: var(--gris); letter-spacing: .3px; }
.ficon.pdf { background: #F6E7E4; border-color: #E9CBC5; color: var(--lacre); }
.ficon.img { background: #E6EEF7; border-color: #CBD8EA; color: var(--azul); }
.ficon.doc { background: #E7ECF6; border-color: #C9D3E8; color: #2D4F8E; }
.ficon.xls { background: #E3F0E9; border-color: #C2DECF; color: var(--verde); }
.folder-ic { width: 32px; height: 38px; flex: none; display: grid; place-items: center; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 14px; font-size: 13px; color: var(--gris); border-top: 1px solid var(--linea-2); }

/* Estados como sellos de registro */
.st { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 3px; border: 1.5px solid currentColor; font-size: 11.5px; font-weight: 700; white-space: nowrap; letter-spacing: .2px; }
.st.borrador { color: var(--ambar); }
.st.en_revision { color: var(--azul); }
.st.aprobado { color: var(--verde); }
.st.archivado { color: var(--violeta); }
.st.destruido { color: var(--lacre); text-decoration: line-through; }
.int { font-size: 10.5px; color: var(--gris); font-weight: 700; margin-left: 6px; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; letter-spacing: .03em; vertical-align: 1px; }
.tree-row.internal { opacity: .72; }
.tree-row.internal::after { content: '⦸'; margin-left: auto; padding-left: 6px; color: var(--gris); font-size: 12px; }
.notice svg { vertical-align: -3px; }
.hold { font-size: 11px; color: var(--lacre); font-weight: 700; margin-left: 6px; }

.empty { text-align: center; padding: 56px 20px; color: var(--gris); }
.empty h3 { font-family: var(--serif); font-weight: 600; color: var(--grafito); font-size: 20px; margin: 10px 0 6px; }
.empty p { margin: 0 auto 16px; max-width: 46ch; }

/* ---------- Zona de soltar archivos ---------- */
.dropzone { position: absolute; inset: 12px; border: 2px dashed var(--azul); border-radius: 12px; background: rgba(244, 246, 243, .94); display: grid; place-items: center; z-index: 30; pointer-events: none; }
.dropzone div { text-align: center; font-family: var(--serif); font-size: 22px; color: var(--tinta); }
.dropzone small { display: block; font-family: var(--sans); font-size: 14px; color: var(--gris); margin-top: 6px; }

/* ---------- Panel de detalle ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(27, 47, 75, .28); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--blanco); z-index: 41; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(27, 47, 75, .18); animation: slidein .2s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.dr-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--linea); display: flex; gap: 12px; align-items: flex-start; }
.dr-head h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0; line-height: 1.2; word-break: break-word; }
.dr-head .meta { font-size: 13px; color: var(--gris); margin-top: 4px; }
.dr-body { flex: 1; overflow: auto; display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
.preview { background: #E9ECE8; min-height: 360px; display: grid; place-items: center; border-right: 1px solid var(--linea); position: relative; }
.preview iframe, .preview object { width: 100%; height: 100%; min-height: 560px; border: 0; background: #fff; }
.preview img { max-width: 100%; max-height: 640px; object-fit: contain; }
.preview pre { margin: 0; padding: 20px; white-space: pre-wrap; font-size: 13px; width: 100%; height: 100%; overflow: auto; background: #fff; }
.preview .nopv { text-align: center; color: var(--gris); padding: 30px; }
.dr-side { padding: 16px; overflow: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--linea); margin: -4px -16px 14px; padding: 0 12px; }
.tabs button { background: none; border: 0; padding: 8px 10px; font-size: 13px; font-weight: 600; color: var(--gris); border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button.on { color: var(--tinta); border-color: var(--tinta); }
dl.kv { margin: 0; display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13.5px; }
dl.kv dt { color: var(--gris); }
dl.kv dd { margin: 0; word-break: break-word; }
.chip { display: inline-block; background: var(--linea-2); border-radius: 10px; padding: 1px 8px; font-size: 12px; margin: 0 4px 4px 0; }
.hash { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--gris); word-break: break-all; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 12px 18px; border-left: 2px solid var(--linea); margin-left: 5px; position: relative; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--gris-2); }
.timeline li:last-child { border-color: transparent; }
.timeline .when { color: var(--gris); font-size: 12px; }
.ver { border: 1px solid var(--linea); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.ver.cur { border-color: var(--tinta-3); }
.ver .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }

/* El sello grande: el elemento memorable */
.seal { margin: 4px 0 16px; border: 2.5px solid currentColor; border-radius: 6px; padding: 8px 12px; display: inline-block; transform: rotate(-2deg); font-weight: 700; position: relative; }
.seal::after { content: ''; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: 3px; opacity: .5; pointer-events: none; }
.seal .s1 { font-family: var(--serif); font-size: 21px; line-height: 1.1; }
.seal .s2 { font-size: 11.5px; font-weight: 600; opacity: .85; }
.seal.borrador { color: var(--ambar); } .seal.en_revision { color: var(--azul); } .seal.aprobado { color: var(--verde); }
.seal.archivado { color: var(--violeta); } .seal.destruido { color: var(--lacre); }

.wf { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.wf .btn { justify-content: center; }
.section-t { font-size: 13px; font-weight: 700; color: var(--grafito); margin: 16px 0 8px; }
.notice { background: var(--manila-2); border: 1px solid var(--manila); border-radius: 6px; padding: 10px 12px; font-size: 13px; color: #5C4A1E; margin-bottom: 12px; }
.notice.red { background: #F8ECE9; border-color: #E6C5BE; color: #7A2B1E; }
.notice.green { background: #E8F3EC; border-color: #C3DDCD; color: #1F5A40; }

/* ---------- Modales ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(27, 47, 75, .35); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 10px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(27, 47, 75, .3); }
.modal.wide { width: min(900px, 100%); }
.modal h3 { font-family: var(--serif); font-size: 21px; font-weight: 600; margin: 0; padding: 18px 20px 10px; }
.modal .mb { padding: 4px 20px 12px; overflow: auto; }
.modal .mf { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--linea-2); }

.upl-row { display: grid; grid-template-columns: 1fr 180px; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--linea-2); align-items: start; }
.upl-row:last-child { border-bottom: 0; }
.upl-file { font-size: 13px; color: var(--gris); display: flex; gap: 8px; align-items: center; grid-column: 1 / -1; }
.bar { height: 4px; background: var(--linea-2); border-radius: 2px; overflow: hidden; grid-column: 1 / -1; }
.bar i { display: block; height: 100%; width: 0; background: var(--azul); transition: width .2s; }
.bar.done i { background: var(--verde); }
.bar.fail i { background: var(--lacre); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--tinta); color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 90vw; }
.toast.bad { background: var(--lacre); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--tinta); color: #E9EEF4; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { font-family: var(--serif); font-weight: 600; font-size: 44px; line-height: 1.08; margin: 0; max-width: 12ch; color: #fff; }
.login-art p { max-width: 40ch; color: #B9C7D8; }
.drawers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 420px; }
.drawers div { height: 64px; border: 1px solid var(--tinta-3); border-radius: 4px; position: relative; }
.drawers div::after { content: ''; position: absolute; left: 50%; top: 24px; width: 34px; height: 10px; margin-left: -17px; border: 1px solid #6E87A6; border-radius: 3px; }
.drawers div:nth-child(5) { background: var(--manila); border-color: var(--manila); }
.drawers div:nth-child(5)::after { border-color: var(--tinta); }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form form { width: min(380px, 100%); }
.login-form h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin: 0 0 6px; }
.login-form .sub { color: var(--gris); margin: 0 0 22px; }

/* ---------- Admin ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--linea); border-radius: 8px; padding: 14px 16px; }
.stat b { display: block; font-family: var(--serif); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--gris); }
.panel { background: #fff; border: 1px solid var(--linea); border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; }
.panel h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 0 0 10px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.okdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--verde); margin-right: 6px; }
.okdot.bad { background: var(--lacre); }
.picker { border: 1px solid var(--linea); border-radius: 6px; max-height: 300px; overflow: auto; padding: 6px; }
.picker .pk { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 14px; border-radius: 4px; }
.picker .pk:hover { background: var(--papel); }
.picker .pk .grow { flex: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .dr-body { grid-template-columns: 1fr; }
  .preview { border-right: 0; border-bottom: 1px solid var(--linea); min-height: 300px; }
  .preview iframe, .preview object { min-height: 420px; }
  .hide-md { display: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(27, 47, 75, .35); }
  .top .menu-btn { display: inline-grid; }
  .top { padding: 10px 14px; }
  .content { padding: 16px 14px 40px; }
  .hide-sm { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px; min-height: 0; }
  .login-art h1 { font-size: 32px; }
  .drawers { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .upl-row { grid-template-columns: 1fr; }
  .mode-banner { display: none; }
  dl.kv { grid-template-columns: 96px 1fr; }
}

/* ---------- Visor a pantalla completa ---------- */
.preview { position: relative; }
.pv-big { position: absolute; right: 12px; bottom: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; background: rgba(27, 47, 75, .92); color: #fff; border: 0; border-radius: 6px; padding: 8px 12px; font: 600 13px var(--sans, inherit); cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.pv-big:hover { background: var(--tinta, #1B2F4B); }
.viewer { position: fixed; inset: 0; z-index: 80; background: #20262e; display: flex; flex-direction: column; }
.vw-bar { display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: var(--blanco, #fff); border-bottom: 1px solid var(--linea, #ddd); }
.vw-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vw-title b { font-family: var(--serif); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-title small { color: var(--gris); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-body { flex: 1; min-height: 0; display: flex; overflow: auto; }
.vw-body iframe { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
.vw-img { margin: auto; padding: 16px; display: flex; justify-content: center; align-items: center; min-width: 100%; min-height: 100%; }
.vw-img img { cursor: zoom-in; background: #fff; box-shadow: 0 2px 20px rgba(0,0,0,.4); }
.vw-img img.fit { max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain; }
.vw-img img:not(.fit) { cursor: zoom-out; }
.vw-txt { flex: 1; margin: 0; padding: 24px; background: #fff; overflow: auto; white-space: pre-wrap; font-size: 14px; }
.vw-body .nopv { margin: auto; color: #fff; text-align: center; }
body.vw-open { overflow: hidden; }
@media (max-width: 820px) { .vw-bar { padding: 8px 10px; flex-wrap: wrap; } .vw-title { flex-basis: 100%; } }
@media print {
  body.vw-open > *:not(.viewer) { display: none !important; }
  .viewer { position: static; background: #fff; display: block; }
  .vw-bar { display: none !important; }
  .vw-body { display: block; overflow: visible; }
  .vw-img { padding: 0; }
  .vw-img img, .vw-img img.fit { max-width: 100%; max-height: none; box-shadow: none; }
  .vw-txt { padding: 0; }
}

/* ---------- Módulo Laboral ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--manila); color: var(--tinta); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-badge.urgent { background: #E05A44; color: #fff; }
.nav-badge[hidden] { display: none; }
.lst { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 3px; border: 1.5px solid currentColor; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.lst.recibida { color: var(--azul); }
.lst.en_curso { color: var(--ambar); }
.lst.pendiente_info { color: var(--lacre); }
.lst.completada { color: var(--verde); }
.lst.cancelada { color: var(--gris-2); text-decoration: line-through; }
.urg { font-size: 10.5px; font-weight: 700; color: #fff; background: var(--lacre); border-radius: 3px; padding: 1px 5px; margin-left: 8px; vertical-align: 1px; letter-spacing: .03em; }
tr.unseen td:first-child b { font-weight: 800; }
tr.unseen td:first-child { box-shadow: inset 3px 0 0 var(--azul); }
.ltype { flex: none; width: 34px; height: 34px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 600; font-size: 17px; color: #fff; }
.ltype.alta { background: var(--verde); } .ltype.baja { background: var(--lacre); } .ltype.variacion { background: var(--azul); }
.lab-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.lab-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: #fff; border: 1px solid var(--linea); border-left: 4px solid var(--azul); border-radius: 8px; text-decoration: none; color: var(--grafito); }
.lab-card.alta { border-left-color: var(--verde); } .lab-card.baja { border-left-color: var(--lacre); }
.lab-card b { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--tinta); }
.lab-card span { font-size: 13px; color: var(--gris); }
.lab-card:hover { border-color: var(--tinta-3); box-shadow: 0 2px 10px rgba(27,47,75,.08); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters .in { width: auto; min-width: 160px; }
.filters input.in { flex: 1; min-width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--linea); border-radius: 6px; overflow: hidden; background: #fff; }
.seg a { padding: 7px 14px; text-decoration: none; color: var(--grafito); font-size: 14px; border-left: 1px solid var(--linea); }
.seg a:first-child { border-left: 0; }
.seg a.on { background: var(--tinta); color: #fff; font-weight: 600; }
.lab-form { max-width: 900px; }
.lab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.lab-grid .wide { grid-column: 1 / -1; }
.lab-grid .f[hidden] { display: none; }
.lab-grid textarea.in, .panel > textarea.in, .lab-grid .f textarea.in { height: auto; padding: 8px 10px; min-height: 70px; }
.f.invalid .in { border-color: var(--lacre); background: #FDF6F4; }
.ferr { color: var(--lacre); font-size: 12.5px; margin-top: 3px; }
.ferr:empty { display: none; }
.filef { padding: 10px 12px; border: 1px dashed var(--linea); border-radius: 6px; margin-bottom: 12px; }
.filef.invalid { border-color: var(--lacre); }
.filef .lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.lab-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
.lab-detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lab-kv { display: grid; grid-template-columns: minmax(140px, 40%) 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.lab-kv dt { color: var(--gris); }
.lab-kv dd { margin: 0; font-weight: 500; word-break: break-word; white-space: pre-line; }
.lab-files { list-style: none; margin: 0; padding: 0; }
.lab-files li { display: flex; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--linea-2); cursor: pointer; border-radius: 4px; }
.lab-files li:hover { background: var(--papel); }
.lab-files li div { min-width: 0; display: flex; flex-direction: column; }
.lab-files small { color: var(--gris); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-events { list-style: none; margin: 0; padding: 0; }
.lab-events li { padding: 8px 0 8px 12px; border-left: 2px solid var(--linea); margin-left: 4px; }
.lab-events li.cli { border-left-color: var(--manila); }
.ev-h { font-size: 12.5px; color: var(--gris); }
.ev-c { white-space: pre-line; font-size: 14px; margin-top: 4px; background: var(--papel); padding: 6px 10px; border-radius: 5px; }
@media (max-width: 1100px) { .lab-detail { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .lab-cards { grid-template-columns: 1fr; } .lab-grid { grid-template-columns: 1fr; } .lab-kv { grid-template-columns: 1fr; } .lab-kv dt { margin-top: 6px; } }
