/*
 * Intranet UDA — estilos por pantalla. Depende de los tokens de base.css.
 */

/* ---------- Barra lateral: detalles ---------- */
.nav-hint { margin-left: auto; display: inline-flex; gap: 2px; opacity: 0; transition: opacity var(--t) var(--ease); }
.nav a:hover .nav-hint, .nav a.active .nav-hint { opacity: 1; }
.nav-hint kbd { min-width: 1.15rem; height: 1.15rem; font-size: 0.62rem; color: var(--ink-300); background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); }

/* ---------- Login ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-brand { display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: 2.5rem 3rem; background: var(--navy); }
.auth-brand-top img { height: 46px; width: auto; padding: 5px 10px; border-radius: 8px; background: #fff; }
.auth-brand-copy h2 { font-size: clamp(1.7rem, 2.6vw, 2.4rem); font-weight: 600; line-height: 1.15; color: #fff; max-width: 18ch; }
.auth-foot { color: var(--ink-400); font-size: 0.78rem; line-height: 1.5; max-width: 60ch; }
.auth-foot p { margin: 0; }
.auth-foot .mono { font-size: 0.72rem; color: var(--ink-300); }
.auth-panel { display: grid; place-items: center; padding: 2rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 390px; }
.auth-logo { display: none; height: 48px; width: auto; margin-bottom: 1.5rem; }
.auth-card h1 { font-size: 1.7rem; margin-bottom: 0.3rem; }
.auth-alert { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; }
.auth-form .btn { margin-top: 1.4rem; }
.auth-steps { margin: 1.25rem 0 1.5rem; padding-left: 1.25rem; display: grid; gap: 0.5rem; }
.auth-forgot { display: block; margin-top: 1rem; text-align: center; font-size: 0.9rem; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-logo { display: block; }
}

/* ---------- Documentos: disposición ---------- */
.docs-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.docs-main { min-width: 0; display: flex; flex-direction: column; gap: 1rem; }

/* Panel del árbol */
.tree-panel { position: sticky; top: calc(64px + 1.5rem); max-height: calc(100vh - 64px - 3rem); overflow-y: auto; padding: 0.6rem; }
.tree-head { display: flex; align-items: center; justify-content: space-between; padding: 0.2rem 0.3rem 0.5rem 0.5rem; }
.tree-head .eyebrow { margin: 0; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { padding-left: 0.85rem; margin-left: 0.62rem; border-left: 1px dashed var(--ink-200); }
.tree-row {
  position: relative; display: flex; align-items: center; gap: 0.2rem; min-height: 2rem; padding: 0 0.25rem; border-radius: var(--r-sm);
  transition: background var(--t-fast) var(--ease);
}
.tree-row:hover { background: var(--surface-2); }
.tree-row.is-current { background: var(--brand-100); }
.tree-row.is-current::before { content: ""; position: absolute; left: -0.6rem; top: 25%; bottom: 25%; width: 3px; border-radius: 2px; background: var(--primary); }
.tree-toggle { display: grid; place-items: center; width: 1.2rem; height: 1.2rem; flex-shrink: 0; color: var(--ink-400); border-radius: 4px; transition: transform var(--t) var(--ease), color var(--t) var(--ease); cursor: pointer; }
.tree-toggle:hover { color: var(--text); }
.tree-toggle.is-leaf { visibility: hidden; }
details.tree-node > summary { list-style: none; }
details.tree-node > summary::-webkit-details-marker { display: none; }
details.tree-node[open] > summary .tree-toggle { transform: rotate(90deg); }
.tree-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.2rem; color: var(--text); font-size: 0.9rem; }
.tree-link:hover { color: var(--text); }
.tree-link .icon { color: #c79a2b; }
.tree-row.is-current .tree-link { color: var(--brand-700); font-weight: 600; }
.tree-row.is-current .tree-link .icon, .tree-link.is-home .icon { color: var(--primary); }
.tree-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-add { opacity: 0; width: 1.6rem; height: 1.6rem; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--text-3); cursor: pointer; transition: opacity var(--t) var(--ease), background var(--t) var(--ease), color var(--t) var(--ease); }
.tree-row:hover .tree-add, .tree-add:focus-visible { opacity: 1; }
.tree-add:hover { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.tree-empty { padding: 0.5rem; font-size: 0.85rem; color: var(--text-3); }
.tree-tags { border-top: 1px solid var(--ink-150); margin-top: 0.7rem; padding: 0.7rem 0.3rem 0.2rem 0.5rem; }
.tree-tags .eyebrow { display: block; margin-bottom: 0.5rem; }
.tree-tags .chip { margin: 0 0.15rem 0.35rem 0; }

/* Cabecera de carpeta: subcarpetas en tarjetas */
.folder-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.6rem; list-style: none; padding: 0; margin: 0; }
.folder-card { display: flex; align-items: center; gap: 0.7rem; padding: 0.75rem 0.9rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease); }
.folder-card:hover { color: var(--text); border-color: var(--brand-300); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.folder-card .folder-glyph { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 9px; color: #b0831c; background: #fbf3dc; border: 1px solid #f0dfad; flex-shrink: 0; }
.folder-card strong { font-weight: 500; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card .icon-arrow { margin-left: auto; color: var(--ink-300); transition: transform var(--t) var(--ease), color var(--t) var(--ease); }
.folder-card:hover .icon-arrow { transform: translateX(2px); color: var(--primary); }

/* Zona de subida */
.dropzone-form { position: relative; }
.dropzone {
  position: relative; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.1rem; overflow: hidden;
  background: var(--surface); border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.dropzone:hover { border-color: var(--brand-400); }
.dropzone.is-over { border-color: var(--brand-500); background: var(--brand-50); box-shadow: 0 0 0 4px var(--focus); }
.dropzone.has-files { border-style: solid; border-color: var(--brand-300); }
.dropzone-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 11px; color: var(--primary); background: var(--brand-100); flex-shrink: 0; transition: transform var(--t) var(--ease-spring); }
.dropzone.is-over .dropzone-icon { transform: translateY(-3px) scale(1.06); }
.dropzone-text { flex: 1 1 14rem; min-width: 0; }
.dropzone-text strong { display: block; font-weight: 600; font-size: 0.93rem; }
.dropzone-text small { color: var(--text-3); font-size: 0.82rem; }
.dropzone-text label.picker { display: inline; margin: 0; font-size: inherit; font-weight: 600; color: var(--primary); cursor: pointer; }
.dropzone-text label.picker:hover { text-decoration: underline; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-files { display: block; margin-top: 0.2rem; font-size: 0.82rem; color: var(--brand-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone-tags { flex: 1 1 16rem; min-width: 0; }
.dropzone-tags .tag-input { min-height: 2.3rem; }
.dropzone-form::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--progress, 0%); border-radius: 3px; background: linear-gradient(90deg, var(--brand-500), var(--signal)); transition: width 160ms linear; opacity: 0; }
.dropzone-form[style*="--progress"]::after { opacity: 1; }

/* Tabla de documentos */
.doc-cell { display: flex; align-items: center; gap: 0.8rem; min-width: 15rem; }
.doc-cell .doc-title { min-width: 0; }
.doc-cell .doc-title a { display: block; color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.doc-cell .doc-title a:hover { color: var(--primary); }
.doc-cell .doc-meta { font-size: 0.78rem; color: var(--text-3); }
.doc-tags { max-width: 18rem; }
.doc-size { font-family: var(--mono); font-size: 0.82rem; color: var(--text-2); }
.doc-when { font-size: 0.85rem; color: var(--text-2); }
.doc-when small { display: block; color: var(--text-3); font-size: 0.76rem; }
.table tbody tr .row-menu { opacity: 0.35; transition: opacity var(--t) var(--ease); }
.table tbody tr:hover .row-menu, .row-menu[open], .row-menu:focus-within { opacity: 1; }
.listing-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.listing-toolbar .count { font-family: var(--mono); font-size: 0.75rem; color: var(--text-3); }

/* Página de etiqueta */
.tag-hero { display: flex; align-items: center; gap: 0.75rem; }
.tag-hero .chip { height: 1.9rem; font-size: 0.95rem; padding: 0 0.7rem 0 0.55rem; }

@media (max-width: 1100px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .tree-panel { position: static; max-height: none; }
}

/* ---------- Utilidades de formulario compactas ---------- */
.inline-row { display: flex; gap: 0.5rem; align-items: stretch; }
.inline-row input, .inline-row select { flex: 1; min-width: 0; }
.inline-row .btn { height: auto; min-height: 2.4rem; }

/* ---------- Buscador ---------- */
.search-bar { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.5rem 0.5rem 1rem; border-radius: var(--r-xl); box-shadow: var(--shadow-md);
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease); }
.search-bar:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--focus), var(--shadow-md); }
.search-bar-icon { color: var(--ink-400); }
.search-bar input[type=search] { flex: 1; min-width: 0; border: 0; box-shadow: none; font-size: 1.05rem; padding-left: 0.2rem; background: transparent; }
.search-bar input[type=search]:focus { box-shadow: none; }
.search-bar select { width: auto; max-width: 13rem; background-color: var(--surface-2); border-color: transparent; }
.search-bar .btn { height: 2.5rem; }
.search-bar.htmx-request .search-bar-icon { animation: spin 900ms linear infinite; }
.search-hints { display: flex; align-items: center; justify-content: center; gap: 0.35rem; margin: 0.7rem 0 1.4rem; font-size: 0.78rem; color: var(--text-3); }
.results-count { font-size: 0.85rem; color: var(--text-2); margin: 0 0 0.6rem; }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; }
.result { padding: 1rem 1.15rem; animation: fade-up var(--t-slow) var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.result:hover { border-color: var(--brand-200); box-shadow: var(--shadow-md); }
.result-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.4rem; }
.result-titles { min-width: 0; display: flex; flex-direction: column; }
.result-title { color: var(--ink-950); font-weight: 600; font-size: 0.98rem; overflow-wrap: anywhere; }
.result-title:hover { color: var(--primary); }
.result-path { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--text-3); }
.result-path a { color: var(--text-2); }
.result-fragment { margin: 0.5rem 0 0; padding-left: 0.8rem; border-left: 2px solid var(--brand-200); font-size: 0.9rem; color: var(--ink-700); line-height: 1.55; }
mark { color: inherit; background: linear-gradient(transparent 55%, color-mix(in oklab, var(--warn-500) 45%, transparent) 55%); padding: 0 1px; border-radius: 2px; font-weight: 600; }
.search-tips { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.7rem; }
.search-tips li { display: flex; gap: 0.75rem; padding: 0.9rem 1rem; }
.search-tips .icon { width: 2rem; height: 2rem; padding: 0.42rem; border-radius: 9px; color: var(--primary); background: var(--brand-100); }
.search-tips strong { display: block; font-size: 0.9rem; font-weight: 600; }
.search-tips span { font-size: 0.82rem; color: var(--text-3); }

/* ---------- Avisos informativos ---------- */
.notice { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.75rem 1rem; border-radius: var(--r-md); font-size: 0.87rem; color: var(--brand-800);
  background: linear-gradient(90deg, var(--brand-100), var(--brand-50)); border: 1px solid var(--brand-200); }
.notice .icon { color: var(--primary); margin-top: 0.15rem; }
.notice p { margin: 0; }

/* ---------- Asistente ---------- */
.assistant-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.conv-list { position: sticky; top: calc(64px + 1.5rem); max-height: calc(100vh - 64px - 3rem); overflow-y: auto; padding: 0.8rem 0.6rem; display: flex; flex-direction: column; gap: 2px; }
.conv-list .eyebrow { padding: 0 0.5rem 0.5rem; }
.conv-item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 0.55rem; padding: 0.5rem 0.55rem; border-radius: var(--r-sm); color: var(--text);
  transition: background var(--t-fast) var(--ease); }
.conv-item:hover { background: var(--surface-2); color: var(--text); }
.conv-item .icon { color: var(--ink-400); }
.conv-item .conv-title { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item small { grid-column: 2; font-size: 0.72rem; color: var(--text-3); }
.conv-item.is-current { background: var(--brand-100); }
.conv-item.is-current .conv-title { font-weight: 600; color: var(--brand-800); }
.conv-item.is-current .icon { color: var(--primary); }

.assistant-main { display: flex; flex-direction: column; gap: 1rem; padding: 1.1rem; min-height: calc(100vh - 64px - 3.5rem); }
.thread { flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.assistant-welcome { margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 2rem 1rem; animation: fade-up var(--t-slow) var(--ease) both; }
.welcome-mark { display: grid; place-items: center; width: 3.4rem; height: 3.4rem; border-radius: 16px; color: #fff; margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--brand-500), var(--navy)); box-shadow: 0 10px 24px -10px rgba(58, 95, 166, 0.7); }
.welcome-mark .icon { width: 1.6rem; height: 1.6rem; }
.assistant-welcome h2 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 0.4rem; max-width: 640px; }
.suggestion { font: inherit; font-size: 0.86rem; color: var(--text-2); padding: 0.5rem 0.85rem; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); transition: all var(--t) var(--ease); }
.suggestion:hover { color: var(--brand-700); border-color: var(--brand-300); background: var(--brand-50); transform: translateY(-1px); }

.msg { max-width: 100%; animation: fade-up var(--t-slow) var(--ease) both; }
.msg p { margin: 0 0 0.5rem; }
.msg p:last-child { margin-bottom: 0; }
.msg-user { align-self: flex-end; max-width: min(78%, 640px); padding: 0.7rem 1rem; border-radius: 16px 16px 4px 16px; color: #fff; overflow-wrap: anywhere;
  background: linear-gradient(160deg, var(--brand-500), var(--brand-700)); box-shadow: 0 6px 16px -8px rgba(44, 74, 136, 0.6); }
.msg-assistant { display: flex; gap: 0.75rem; align-items: flex-start; }
.msg-avatar { display: grid; place-items: center; width: 2rem; height: 2rem; flex-shrink: 0; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--brand-500), var(--navy)); }
.msg-content { flex: 1; min-width: 0; padding: 0.8rem 1rem; border-radius: 4px 16px 16px 16px; background: var(--ink-50); border: 1px solid var(--ink-150); }
.msg-body { line-height: 1.6; }
.msg-lead { font-weight: 600; }
.cite-ref { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 0.2rem; margin: 0 1px; vertical-align: 2px; border-radius: 4px;
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500; color: var(--brand-700); background: var(--brand-100); border: 1px solid var(--brand-200); }
.cite-ref:hover { background: var(--primary); color: #fff; }
.citations { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.5rem; }
.citation { display: flex; gap: 0.6rem; padding: 0.6rem 0.7rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease); }
.citation:target { border-color: var(--warn-500); box-shadow: 0 0 0 3px color-mix(in oklab, var(--warn-500) 25%, transparent); }
.citation-n { display: grid; place-items: center; width: 1.4rem; height: 1.4rem; flex-shrink: 0; border-radius: 6px; font-family: var(--mono); font-size: 0.72rem; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); }
.citation-doc { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 500; font-size: 0.88rem; overflow-wrap: anywhere; }
.citation p { margin: 0.2rem 0 0; font-size: 0.83rem; color: var(--text-3); line-height: 1.5; }
.msg-meta { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.6rem !important; font-size: 0.76rem; color: var(--text-3); }

.typing { align-items: center; gap: 0.6rem; }
.typing:not(.htmx-request) { display: none; }
.typing.htmx-request { display: flex; }
.typing-dots { display: inline-flex; gap: 4px; padding: 0.55rem 0.75rem; border-radius: 12px; background: var(--ink-50); border: 1px solid var(--ink-150); }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-500); animation: blink-dot 1.1s var(--ease) infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; } .typing-dots i:nth-child(3) { animation-delay: 0.3s; }

.composer { position: sticky; bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; align-items: end; padding: 0.55rem;
  border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-md);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.composer:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--focus), var(--shadow-md); }
.composer textarea { border: 0; box-shadow: none; resize: none; min-height: 2.5rem; max-height: 220px; padding: 0.55rem 0.6rem; background: transparent; }
.composer textarea:focus { box-shadow: none; }
.composer-send { width: 2.5rem; height: 2.5rem; border-radius: 12px; }
.composer-hint { grid-column: 1 / -1; margin: 0 0 0 0.6rem; font-size: 0.72rem; color: var(--text-3); display: flex; align-items: center; gap: 0.3rem; }
.composer-hint kbd { height: 1.2rem; font-size: 0.64rem; }

@media (max-width: 1000px) {
  .assistant-layout { grid-template-columns: minmax(0, 1fr); }
  .conv-list { position: static; max-height: 14rem; }
  .assistant-main { min-height: 70vh; }
  .search-bar { flex-wrap: wrap; }
  .search-bar select { max-width: none; flex: 1; }
}

/* ---------- Chat ---------- */
.chat-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.chat-sidebar { padding: 0.8rem 0.6rem; }
.chat-list { display: flex; flex-direction: column; gap: 2px; }
.chat-item { grid-template-columns: auto minmax(0, 1fr) auto; }
.chat-item .avatar { grid-row: span 2; }
.chat-item small { grid-column: 2 / 4; }
.chat-item .unread { grid-row: 1; grid-column: 3; }
.avatar-group { color: var(--brand-700); background: var(--brand-100); box-shadow: inset 0 0 0 1px var(--brand-200); }

.chat-main { display: flex; flex-direction: column; height: calc(100vh - 64px - 3.5rem); min-height: 460px; overflow: hidden; }
.chat-main #chat-flash:empty { display: none; }
.chat-main #chat-flash { padding: 0.8rem 1rem 0; }
.chat-thread { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; padding: 1.2rem 1.2rem 0.6rem; scroll-behavior: smooth;
  background: linear-gradient(180deg, var(--ink-50), var(--surface) 140px); }
.chat-msg { display: flex; align-items: flex-end; gap: 0.55rem; max-width: min(76%, 620px); animation: fade-up var(--t) var(--ease) both; }
.chat-msg[data-group-start] { margin-top: 0.7rem; }
.chat-msg .avatar { visibility: hidden; }
.chat-msg[data-group-start] .avatar { visibility: visible; }
.chat-msg .bubble { position: relative; padding: 0.5rem 0.8rem 0.4rem; border-radius: 4px 14px 14px 4px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); overflow-wrap: anywhere; }
.chat-msg[data-group-start] .bubble { border-top-left-radius: 14px; }
.chat-msg .bubble p { margin: 0; line-height: 1.45; }
.chat-sender { display: none; font-size: 0.75rem; font-weight: 600; color: var(--primary); margin-bottom: 0.1rem; }
.chat-msg[data-group-start] .chat-sender { display: block; }
.chat-msg time { display: block; text-align: right; font-family: var(--mono); font-size: 0.64rem; color: var(--text-3); margin-top: 0.1rem; }
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.mine .bubble { color: #fff; border: 0; border-radius: 14px 4px 4px 14px; background: linear-gradient(160deg, var(--brand-500), var(--brand-700)); box-shadow: 0 4px 12px -6px rgba(44, 74, 136, 0.55); }
.chat-msg.mine[data-group-start] .bubble { border-top-right-radius: 14px; }
.chat-msg.mine time { color: rgba(255, 255, 255, 0.7); }
.day-sep { display: flex; align-items: center; gap: 0.8rem; margin: 1rem 0 0.2rem; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.chat-empty { margin: auto; }
.chat-composer { position: static; margin: 0.6rem 1rem 1rem; }
.chat-placeholder { margin: auto; }

.people { list-style: none; margin: 0.5rem 0 0; padding: 0.25rem; max-height: 15rem; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--ink-50); }
.person { display: flex; align-items: center; gap: 0.65rem; margin: 0; padding: 0.4rem 0.5rem; border-radius: var(--r-sm); font-weight: 400; font-size: 0.92rem; color: var(--text); cursor: pointer; transition: background var(--t-fast) var(--ease); }
.person:hover { background: var(--surface); }
.person:has(input:checked) { background: var(--brand-100); }
.person:has(input:checked) .person-name { font-weight: 600; color: var(--brand-800); }
.people-empty { padding: 0.5rem; font-size: 0.85rem; color: var(--text-3); }

/* ---------- Formularios de una columna ---------- */
.narrow-form { max-width: 560px; }
.form-head { display: flex; align-items: center; gap: 0.8rem; padding-bottom: 0.4rem; margin-bottom: 0.2rem; }
.form-head h2 { font-size: 1rem; }
.form-head p { margin: 0.1rem 0 0; }
.form-head-icon { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 11px; color: var(--primary); background: var(--brand-100); flex-shrink: 0; }

@media (max-width: 1000px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-sidebar { max-height: 13rem; overflow-y: auto; }
  .chat-main { height: 72vh; }
  .chat-msg { max-width: 90%; }
}

/* ---------- Gestión ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: -0.25rem 0 1.25rem; padding: 0.25rem; width: max-content; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.subnav a { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.8rem; border-radius: var(--r-md); color: var(--text-2); font-size: 0.88rem; font-weight: 500; transition: all var(--t) var(--ease); }
.subnav a:hover { color: var(--text); background: var(--surface-2); }
.subnav a.active { color: #fff; background: var(--navy); box-shadow: 0 2px 6px -2px rgba(26, 44, 72, 0.5); }
.subnav a .icon { opacity: 0.85; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.toolbar select { width: auto; min-width: 13rem; }
.toolbar-search { flex: 1 1 18rem; max-width: 26rem; }
.person-cell { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--text); }
.person-cell:hover { color: var(--primary); }
.person-cell strong { font-weight: 500; }
.person-cell small { display: block; font-size: 0.78rem; color: var(--text-3); }
.person-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.35rem 0 0; }
.form-divider { height: 1px; background: var(--ink-150); margin: 1.1rem 0 0.2rem; }
.switch-row { margin-top: 0.4rem; padding: 0.6rem 0.8rem; border-radius: var(--r-md); background: var(--ink-50); border: 1px solid var(--ink-150); }
.switch-row label.check { margin: 0; }
.folder-indent { display: inline-flex; align-items: center; gap: 0.5rem; padding-left: calc(var(--depth, 0) * 1.1rem); }
.folder-indent .icon { color: #c79a2b; }
.field-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-700); margin: 0.9rem 0 0.35rem; }
.grants { list-style: none; margin: 0; padding: 0; }
.grant { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--ink-150); }
.grant:first-child { padding-top: 0; }
.grant:last-child { border-bottom: 0; padding-bottom: 0; }
.grant-subject { flex: 1 1 8rem; font-weight: 500; }
.grant form { margin: 0; }
.table td .badge + .badge { margin-left: 0.3rem; }
form:has(input[name=target][value=role]:checked) [data-field=user] { display: none; }
.radios label.check { display: inline-flex; margin-right: 1rem; }

/* ---------- Registro de actividad ---------- */
.live-status { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--mono); font-size: 0.75rem; color: var(--text-3); padding: 0.3rem 0.65rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.live-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-300); }
.live-status.is-live::before { background: var(--ok-500); box-shadow: 0 0 0 0 color-mix(in oklab, var(--ok-500) 60%, transparent); animation: pulse-ring 1.8s var(--ease) infinite; }
.live-status.is-stalled::before { background: var(--danger-500); }
.audit-table td { vertical-align: top; }
.audit-detail { max-width: 34rem; overflow-wrap: anywhere; color: var(--text-2); }
.new-row { animation: fade-up var(--t-slow) var(--ease) both; }
.new-row td { background: linear-gradient(90deg, color-mix(in oklab, var(--warn-100) 90%, transparent), transparent); }

/* ---------- Estado del servicio ---------- */
.status-overall { margin: 0 0 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.status-section { margin-top: 1.6rem; }
.status-section > .eyebrow { margin: 0 0 0.6rem; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14.5rem, 1fr)); gap: 0.9rem; }
.status-card { border-top: 3px solid var(--border-strong); }
.status-card.status-ok { border-top-color: var(--ok-500); }
.status-card.status-aviso { border-top-color: var(--warn-500); }
.status-card.status-fallo { border-top-color: var(--danger-500); }
.status-card header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.status-card h3 { font-size: 0.92rem; font-weight: 600; margin: 0; flex: 1; }
.status-card header + .status-value { margin-top: 0; }
.status-card > h3 { margin-bottom: 0.6rem; }
.status-glyph { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-500); flex-shrink: 0; }
.status-value { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.3rem; color: var(--text); overflow-wrap: anywhere; }
.status-card p { margin: 0 0 0.2rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tbody th[scope=row] { text-align: left; font-weight: 400; padding: 0.75rem 1rem; border-bottom: 1px solid var(--ink-150); font-family: inherit; font-size: inherit; letter-spacing: normal; text-transform: none; color: var(--text); position: static; background: none; }
