/* Galileo · Revisión societaria — lenguaje visual de galileolegal.ai */
:root {
  /* Tokens del prototipo aprobado v2 */
  --bg: #f8f9fb; --surface: #ffffff; --surface-2: #f2f4f9; --ink: #1a1a2d; --muted: #667388; --line: #e3e7ef;
  --brand: #406ce3; --brand-ink: #ffffff; --brand-soft: #eef2fd; --navy: #05063e; --accent: #e5ce4f; --accent-ink: #8a6d00; --accent-soft: #fbf6dc;
  --ok: #2f7a5a; --ok-soft: #eaf7f0; --warn: #9a6400; --warn-soft: #fdf3dc; --crit: #c4321f; --crit-soft: #fdebe8; --pend: #ffe867;
  --s1: #406ce3; --s2: #e5ce4f; --s3: #bcc6d8;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 12px;
  color-scheme: light;
  /* Nombres anteriores (compatibilidad con las pantallas existentes) */
  --text: var(--ink); --text-2: var(--muted); --text-3: color-mix(in srgb, var(--muted) 78%, var(--surface)); --text-body: var(--ink);
  --border: var(--line); --border-hover: color-mix(in srgb, var(--line) 65%, var(--muted)); --bg-alt: var(--surface-2);
  --brand-hover: color-mix(in srgb, var(--brand) 86%, #000); --brand-glow: color-mix(in srgb, var(--brand) 25%, transparent);
  --success: var(--ok); --success-bg: var(--ok-soft); --warning: var(--warn); --warning-bg: var(--warn-soft);
  --danger: var(--crit); --danger-bg: var(--crit-soft); --chip: var(--surface-2); --track: var(--surface-2);
  --nav-bg: color-mix(in srgb, var(--bg) 88%, transparent); --gold: var(--brand);
  --radius-sm: 8px; --radius-md: 10px; --radius-lg: 12px; --radius-full: 100px;
  --shadow: 0 1px 2px rgba(19, 32, 51, 0.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-alt);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Navegación ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-container {
  max-width: 1240px; margin: 0 auto; padding: 0 24px;
  height: 68px; display: flex; align-items: center; gap: 36px;
}
.nav-logo img { height: 34px; display: block; }
.nav-links { display: flex; gap: 6px; flex: 1; }
.nav-links a {
  color: var(--text-2); font-weight: 500; font-size: 0.95rem;
  padding: 8px 14px; border-radius: var(--radius-full);
}
.nav-links a:hover { color: var(--text); background: var(--bg-alt); }
.nav-links a.active { color: var(--brand); background: var(--brand-soft); }
.user-menu { position: relative; }
.user-menu summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 4px 4px; border-radius: var(--radius-full);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--bg-alt); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #667eea); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 0.8rem;
}
.user-name { font-size: 0.9rem; font-weight: 500; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12); padding: 6px;
}
.menu a { display: block; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text); font-size: 0.92rem; }
.menu a:hover { background: var(--bg-alt); }
.menu .menu-email { padding: 8px 12px 10px; color: var(--text-3); font-size: 0.8rem; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* ---------- Layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.85rem; font-weight: 600; letter-spacing: -0.02em; }
.page-head p { color: var(--text-2); margin-top: 2px; }
.muted { color: var(--text-2); }
.small { font-size: 0.85rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px 24px; }
.card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-full);
  padding: 10px 20px; font-weight: 500; font-size: 0.95rem; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px var(--brand-glow); }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-alt); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); padding: 8px 12px; }
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }
.btn-danger-ghost { background: transparent; color: var(--danger); padding: 8px 12px; }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 500; font-size: 0.9rem; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s; font-size: 0.95rem;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.field { margin-bottom: 16px; }
.hint { font-size: 0.82rem; color: var(--text-3); margin-top: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }

/* ---------- Avisos ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 18px; font-size: 0.93rem; border: 1px solid; }
.alert-ok { background: var(--success-bg); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--danger-bg); border-color: #fecaca; color: #991b1b; }
.alert-warn { background: var(--warning-bg); border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--brand-soft); border-color: #c7d7fb; color: #1e3a8a; }

/* ---------- Insignias ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.78rem; font-weight: 500; white-space: nowrap; border: 1px solid transparent;
}
.badge-ok { background: var(--success-bg); color: #047857; }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--chip); color: var(--text-2); }
.badge-accent { background: var(--brand-soft); color: var(--brand); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Autenticación ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 10% -10%, rgba(47,109,236,0.10), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(102,126,234,0.10), transparent 60%), var(--bg-alt); }
.auth-card { width: 100%; max-width: 420px; padding: 36px 34px; }
.auth-logo { height: 42px; margin: 0 auto 22px; display: block; }
.auth-card h1 { font-size: 1.4rem; font-weight: 600; text-align: center; }
.auth-card .sub { text-align: center; color: var(--text-2); margin: 4px 0 24px; font-size: 0.95rem; }

/* ---------- Lista de casos ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--text-3); }
.search .input { padding-left: 40px; border-radius: var(--radius-full); }
.cases-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.case-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; color: var(--text); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.case-card:hover { border-color: #c7d7fb; transform: translateY(-2px); box-shadow: 0 10px 28px rgba(47,109,236,0.10); color: var(--text); }
.case-card h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.case-meta { display: flex; gap: 14px; color: var(--text-2); font-size: 0.85rem; flex-wrap: wrap; }
.progress { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #667eea); border-radius: 99px; transition: width 0.4s; }
.progress.ok > span { background: var(--success); }
.empty { text-align: center; padding: 64px 24px; }
.empty-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 16px; }
.empty-icon svg { width: 30px; height: 30px; }
.empty h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 6px; }
.empty p { color: var(--text-2); max-width: 440px; margin: 0 auto 20px; }

/* Modal */
dialog { border: none; border-radius: var(--radius-lg); padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(15,23,42,0.25); margin: auto; }
dialog::backdrop { background: rgba(5, 6, 65, 0.35); backdrop-filter: blur(2px); }
.modal-body { padding: 26px 26px 22px; }
.modal-body h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Detalle de caso ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 0.9rem; margin-bottom: 14px; }
.back:hover { color: var(--text); }
.case-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.case-title { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 2px 8px; margin-left: -9px; background: transparent; width: min(640px, 100%); }
.case-title:hover { border-color: var(--border); }
.case-title:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--surface); }
.case-sub { display: flex; gap: 12px; align-items: center; color: var(--text-2); font-size: 0.9rem; flex-wrap: wrap; margin-top: 4px; }
.inline-select { border: 1px solid var(--border); border-radius: var(--radius-full); padding: 4px 30px 4px 12px; background: var(--surface); font-size: 0.85rem; cursor: pointer; }

.dropzone {
  border: 2px dashed #c7d7fb; border-radius: var(--radius-lg); background: var(--surface);
  padding: 34px 24px; text-align: center; cursor: pointer; transition: background 0.15s, border-color 0.15s;
  margin-bottom: 22px; position: relative;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .dz-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 12px; }
.dropzone .dz-icon svg { width: 28px; height: 28px; }
.dropzone strong { font-size: 1.08rem; font-weight: 600; display: block; }
.dropzone span { color: var(--text-2); font-size: 0.92rem; }
.dz-progress { max-width: 360px; margin: 14px auto 0; }

.case-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 960px) { .case-grid { grid-template-columns: 1fr; } }
.side { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 88px; }
@media (max-width: 960px) { .side { position: static; } }

.doc-list { display: flex; flex-direction: column; }
.doc { padding: 16px 0; border-top: 1px solid var(--border); }
.doc:first-child { border-top: none; padding-top: 4px; }
.doc-top { display: flex; align-items: center; gap: 12px; }
.file-icon { width: 38px; height: 38px; flex: none; border-radius: 10px; background: #fff1f0; color: #e5484d; display: grid; place-items: center; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.02em; }
.file-icon.img { background: #f0f7ff; color: var(--brand); }
.doc-name { font-weight: 500; font-size: 0.95rem; word-break: break-word; line-height: 1.3; }
.doc-name small { display: block; color: var(--text-3); font-weight: 400; font-size: 0.8rem; margin-top: 2px; }
.doc-actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: none; background: transparent; color: var(--text-3); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--bg-alt); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.icon-btn svg { width: 17px; height: 17px; }
.part { margin: 10px 0 0 50px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--bg-alt); border: 1px solid #edf1f6; }
.part-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.type-select { border: 1px solid #c7d7fb; background: var(--surface); color: var(--brand); font-weight: 500; border-radius: var(--radius-full); padding: 4px 28px 4px 12px; font-size: 0.85rem; max-width: 100%; cursor: pointer; }
.part p { font-size: 0.9rem; color: var(--text-body); margin-top: 8px; }
.obs { margin-top: 8px; padding-left: 0; list-style: none; }
.obs li { font-size: 0.86rem; color: #92400e; display: flex; gap: 6px; margin-top: 3px; }
.obs li::before { content: "⚠"; }
details.datos { margin-top: 8px; }
details.datos summary { cursor: pointer; color: var(--brand); font-size: 0.85rem; font-weight: 500; }
.kv { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.85rem; }
.kv td { padding: 5px 8px; border-top: 1px solid var(--border); vertical-align: top; }
.kv td:first-child { color: var(--text-2); width: 38%; }
.status-line { margin: 8px 0 0 50px; font-size: 0.88rem; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.status-line.error { color: var(--danger); }
.spinner { width: 15px; height: 15px; border: 2px solid #c7d7fb; border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.checklist { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-radius: var(--radius-sm); font-size: 0.92rem; }
.ck { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; margin-top: 1px; }
.ck svg { width: 13px; height: 13px; }
.ck-ok { background: var(--success); color: #fff; }
.ck-observaciones { background: #f59e0b; color: #fff; }
.ck-invalido { background: var(--danger); color: #fff; }
.ck-faltante { border: 2px dashed var(--border-hover); }
.checklist .ck-text small { display: block; color: var(--text-3); font-size: 0.8rem; }
.summary-num { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.summary-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }

.profile-card { margin-top: 22px; }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.psection { margin-top: 22px; }
.psection h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand); font-weight: 600; margin-bottom: 8px; }
.pfields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
@media (max-width: 760px) { .pfields { grid-template-columns: 1fr; } }
.pfield.long { grid-column: 1 / -1; }
.pfield label { font-size: 0.8rem; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
.pfield .input { padding: 8px 11px; font-size: 0.92rem; }
.pfield textarea.input { min-height: 64px; resize: vertical; }
.src { font-size: 0.75rem; color: var(--text-3); margin-top: 3px; }
.ptable-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.ptable { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 640px; }
.ptable th { text-align: left; font-weight: 500; color: var(--text-2); background: var(--bg-alt); padding: 8px 10px; font-size: 0.8rem; border-bottom: 1px solid var(--border); }
.ptable td { padding: 4px 6px; border-top: 1px solid var(--border); }
.ptable td input { width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 6px 6px; background: transparent; font-size: 0.88rem; }
.ptable td input:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.ptable td.rm { width: 36px; }
.save-bar { position: sticky; bottom: 16px; margin-top: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--navy); color: #fff; border-radius: var(--radius-md); padding: 12px 16px; box-shadow: 0 12px 30px rgba(5,6,65,0.25); }
.save-bar .btn-primary { box-shadow: none; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: var(--radius-full); font-size: 0.92rem; box-shadow: 0 12px 30px rgba(5,6,65,0.3); z-index: 100; max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); }

/* ---------- Usuarios ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 0.82rem; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.cred { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface); border: 1px dashed var(--brand); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 1.05rem; display: inline-block; margin: 6px 0; user-select: all; }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.footer-note { text-align: center; color: var(--text-3); font-size: 0.8rem; margin-top: 40px; }

/* ===================================================================== */
/* Tema oscuro (se activa con el botón luna/sol; se recuerda en el equipo) */
/* ===================================================================== */
:root[data-theme="dark"] {
  --bg: #0a0b26; --surface: #13153a; --surface-2: #1a1d48; --ink: #eceef8; --muted: #a0a8c4; --line: #2a2e5e;
  --brand: #7d9cf0; --brand-ink: #0a0b26; --brand-soft: #1f2758; --navy: #05063e; --accent: #ebd45e; --accent-ink: #ebd45e; --accent-soft: #38331a;
  --ok: #5cc28d; --ok-soft: #163327; --warn: #e9b04e; --warn-soft: #3a2d12; --crit: #f08a7e; --crit-soft: #3d1d1a; --pend: #d9c23a;
  --s1: #7d9cf0; --s2: #ebd45e; --s3: #4a527e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}
:root[data-theme="dark"] .badge-ok { color: #6ee7b7; }
:root[data-theme="dark"] .obs li { color: #fbbf24; }
:root[data-theme="dark"] .menu { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

.theme-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; flex: none; }
.theme-btn:hover { color: var(--text); border-color: var(--border-hover); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .ico-sun { display: none; }
:root[data-theme="dark"] .theme-btn .ico-sun { display: block; }
:root[data-theme="dark"] .theme-btn .ico-moon { display: none; }
.nav-service { font-size: 0.9rem; color: var(--text-2); font-weight: 500; padding: 6px 12px; border-radius: var(--radius-full); background: var(--bg-alt);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
@media (max-width: 720px) {
  .nav-container { gap: 12px; padding: 0 14px; }
  .nav-links, .user-name { display: none; }
  .nav-service { max-width: 150px; font-size: 0.82rem; }
  .container { padding: 20px 14px 48px; }
  .page-head h1 { font-size: 1.45rem; }
}

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 18px 20px; }
.kpi .k-label { font-size: 0.86rem; color: var(--text-2); }
.kpi .k-value { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin-top: 6px; }
.kpi .k-sub { font-size: 0.82rem; color: var(--text-3); margin-top: 4px; }
.delta-up { color: #047857; } .delta-down { color: var(--danger); }
:root[data-theme="dark"] .delta-up { color: #34d399; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.card h2.c-title { font-size: 1rem; font-weight: 600; }
.c-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.c-sub { font-size: 0.82rem; color: var(--text-3); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-full); padding: 2px; background: var(--bg-alt); }
.seg button { border: none; background: transparent; padding: 4px 12px; border-radius: var(--radius-full); font-size: 0.8rem; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Gráficos (rampa ordinal azul para los estados de la cola; una sola serie en el resto) */
.viz { --st-1: #86b6ef; --st-2: #2a78d6; --st-3: #104281; --serie: #2a78d6; --grid: #e1e0d9; --base: #c3c2b7; }
:root[data-theme="dark"] .viz { --st-1: #184f95; --st-2: #3987e5; --st-3: #86b6ef; --serie: #3987e5; --grid: #2c2c2a; --base: #383835; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hrow { display: grid; grid-template-columns: 150px minmax(0, 1fr) 36px; align-items: center; gap: 10px; padding: 5px 0; font-size: 0.86rem; cursor: pointer; border-radius: 6px; }
.hrow:hover { background: var(--bg-alt); }
.hrow .h-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.hrow .h-val { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.stack { display: flex; gap: 2px; height: 14px; }
.stack > i { display: block; height: 100%; min-width: 2px; }
.stack > i:first-child { border-radius: 4px 0 0 4px; } .stack > i:last-child { border-radius: 0 4px 4px 0; }
.stack > i:only-child { border-radius: 4px; }
.hbar { height: 14px; display: flex; align-items: center; gap: 8px; }
.hbar > i { display: block; height: 100%; background: var(--serie); border-radius: 0 4px 4px 0; min-width: 2px; }
.rank-diff { font-size: 0.78rem; color: var(--text-3); white-space: nowrap; }
.segbar { display: flex; gap: 2px; height: 28px; margin: 6px 0 12px; }
.segbar > i { display: flex; align-items: center; padding-left: 8px; font-style: normal; font-size: 0.78rem; font-weight: 600; color: #fff; border-radius: 4px; min-width: 0; overflow: hidden; }
.segbar > i.light-ink { color: #0b0b0b; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 150px; border-bottom: 1px solid var(--base); padding-top: 18px; }
.cols .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; cursor: default; }
.cols .col i { display: block; width: 100%; max-width: 24px; background: var(--serie); border-radius: 4px 4px 0 0; min-height: 0; }
.cols .col b { position: absolute; top: 0; font-size: 0.72rem; font-weight: 500; color: var(--text-2); }
.cols-x { display: flex; gap: 6px; font-size: 0.68rem; color: var(--text-3); margin-top: 6px; }
.cols-x span { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; }
.tip { position: fixed; z-index: 200; pointer-events: none; background: var(--navy); color: #fff; font-size: 0.8rem; padding: 7px 10px; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,0.25); max-width: 260px; }
details.as-table { margin-top: 10px; font-size: 0.82rem; }
details.as-table summary { cursor: pointer; color: var(--text-3); }
details.as-table table { margin-top: 8px; }

/* Tablas del servicio */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tbl th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 0.78rem; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--bg-alt); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.dchip { font-size: 0.7rem; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--chip); color: var(--text-3); letter-spacing: 0.02em; }
.dchip.on { background: var(--brand-soft); color: var(--brand); }
.dias-alerta { color: var(--danger); font-weight: 600; }
.mini-progress { display: flex; align-items: center; gap: 8px; min-width: 90px; }
.mini-progress .progress { flex: 1; height: 5px; }
.st { font-size: 0.76rem; font-weight: 500; padding: 3px 9px; border-radius: 99px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-sin_documentos { background: var(--chip); color: var(--text-2); }
.st-documentacion_incompleta { background: var(--warning-bg); color: var(--warning); }
.st-listo_para_generar { background: var(--brand-soft); color: var(--brand); }
.st-generado_con_pendientes { background: var(--warning-bg); color: var(--warning); }
.st-generado { background: var(--success-bg); color: #047857; }
.st-enviado_dd { background: var(--success-bg); color: #047857; }
:root[data-theme="dark"] .st-generado, :root[data-theme="dark"] .st-enviado_dd { color: #6ee7b7; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters .input { width: auto; min-width: 160px; padding: 9px 12px; }
.filters .search { flex: 1; min-width: 200px; }

/* Caso */
.case-top { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 18px; }
.case-top h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.meta { display: flex; gap: 8px 16px; flex-wrap: wrap; color: var(--text-2); font-size: 0.88rem; margin-top: 6px; align-items: center; }
.case-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.doc-row:first-child { border-top: none; }
.doc-row .d-main { flex: 1; min-width: 0; }
.doc-row .d-name { font-weight: 500; font-size: 0.93rem; word-break: break-word; }
.doc-row .d-sub { font-size: 0.8rem; color: var(--text-3); margin-top: 2px; }
.recon { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.recon .badge { font-size: 0.75rem; }
.notif { border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius-md); padding: 14px 16px; background: var(--surface); margin-bottom: 16px; }
.notif p { font-size: 0.93rem; }
.notif .progress { margin: 10px 0; height: 8px; }
.sug { border: 1px solid var(--border); border-radius: var(--radius-md); margin-top: 8px; background: var(--surface); }
.sug summary { list-style: none; cursor: pointer; padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sug summary::-webkit-details-marker { display: none; }
.sug .plus { font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; min-width: 82px; }
.sug .s-body { padding: 0 14px 12px; font-size: 0.86rem; color: var(--text-2); }
.sug .s-body ul { margin: 6px 0 10px 18px; }
.group-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); font-weight: 600; margin: 16px 0 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: none; background: none; padding: 10px 14px; font-size: 0.9rem; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button small { margin-left: 6px; font-size: 0.72rem; padding: 1px 7px; border-radius: 99px; background: var(--warning-bg); color: var(--warning); }
.tabs button small.na { background: var(--chip); color: var(--text-3); }
.frow { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 10px 4px; border-top: 1px solid var(--border); }
.frow:first-child { border-top: none; }
.f-ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 0.7rem; font-weight: 700; margin-top: 1px; }
.f-ok { background: var(--success); color: #fff; }
.f-pend { background: #ffe867; color: #5c4b00; }
.f-alta { background: var(--danger); color: #fff; }
.f-na { border: 2px dashed var(--border-hover); }
.f-label { font-size: 0.9rem; font-weight: 500; }
.f-val { font-size: 0.88rem; color: var(--text-body); margin-top: 2px; word-break: break-word; }
.f-src { font-size: 0.76rem; color: var(--text-3); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.f-edit { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.f-edit .input { padding: 7px 10px; font-size: 0.88rem; max-width: 420px; }
.a-validar { font-size: 0.72rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--warning-bg); color: var(--warning); }
.validado { font-size: 0.72rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--success-bg); color: #047857; }
.link-btn { border: none; background: none; color: var(--brand); font-size: 0.8rem; cursor: pointer; padding: 0; font-weight: 500; }
.sec-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--brand); font-weight: 600; margin: 18px 0 4px; }
.pages img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; background: #fff; margin-bottom: 12px; display: block; }
.alert-row { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 0.88rem; }
.alert-row:first-child { border-top: none; }
.lvl { font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; height: fit-content; white-space: nowrap; }
.lvl-alta { background: var(--danger-bg); color: var(--danger); }
.lvl-media { background: var(--warning-bg); color: var(--warning); }
.lvl-baja, .lvl-info { background: var(--chip); color: var(--text-2); }
.drop-sm { border: 2px dashed var(--border-hover); border-radius: var(--radius-md); padding: 16px; text-align: center; cursor: pointer; color: var(--text-2); font-size: 0.9rem; }
.drop-sm:hover, .drop-sm.drag { border-color: var(--brand); background: var(--brand-soft); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg-alt); padding: 12px 0; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
/* ===================================================================== */
/* Rediseño v2 · prototipo aprobado (plataforma_galileo_v2.html)          */
/* ===================================================================== */
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--ink); }
h1, h2, h3 { letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }

/* Botones y formularios */
.btn { border-radius: 8px; padding: 10px 16px; font-weight: 600; font-size: 0.93rem; box-shadow: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 2px rgba(64, 108, 227, 0.25); }
.btn-primary:hover { background: var(--brand); color: var(--brand-ink); filter: brightness(1.08); }
.btn-secondary, .btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); padding: 10px 16px; }
.btn-secondary:hover, .btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-warn { background: var(--accent); color: #1a1a2d; }
.btn-warn:hover { color: #1a1a2d; filter: brightness(1.05); }
.btn-danger-ghost { background: var(--surface); border: 1px solid color-mix(in srgb, var(--crit) 40%, var(--line)); color: var(--crit); padding: 10px 16px; }
.btn-danger-ghost:hover { background: var(--crit-soft); color: var(--crit); }
.btn-sm, .btn-secondary.btn-sm, .btn-ghost.btn-sm, .btn-danger-ghost.btn-sm { padding: 6px 11px; font-size: 0.82rem; }
.btn-lg { padding: 13px 20px; font-size: 0.98rem; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }
.link { color: var(--brand); background: none; border: 0; padding: 0; font-weight: 600; cursor: pointer; font-size: inherit; }
.field { display: grid; gap: 6px; margin: 0 0 14px; }
.field label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; margin: 0; }
.input, select.input, textarea.input { border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 10px 12px; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.check { color: var(--ink); }

/* Tarjetas, avisos y etiquetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: none; }
.card-pad { padding: 18px; }
.empty-icon { background: var(--brand-soft); color: var(--brand); }
.alert { border-radius: 12px; padding: 14px 16px; border: 1px solid; color: var(--ink); }
.alert-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); color: var(--ink); }
.alert-error { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 35%, var(--line)); color: var(--ink); }
.alert-warn { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); color: var(--ink); }
.alert-info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); color: var(--ink); }
.chip, .badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; border: 0; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-ok, .badge-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn, .badge-warn { background: var(--warn-soft); color: var(--warn); }
.chip-crit, .badge-danger { background: var(--crit-soft); color: var(--crit); }
.chip-info, .badge-accent { background: var(--brand-soft); color: var(--brand); }
.chip-mute, .badge-neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip-sent { background: color-mix(in srgb, var(--navy) 10%, var(--surface)); color: var(--navy); }
:root[data-theme="dark"] .chip-sent, :root[data-theme="dark"] .st-enviado_dd { background: #26295c; color: #cdd5ff; }
:root[data-theme="dark"] .badge-ok { color: var(--ok); }
.dchip { font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); background: transparent; font-weight: 400; letter-spacing: 0; }
.dchip.on { background: var(--brand-soft); color: var(--brand); border-color: transparent; font-weight: 500; }
/* Estados del caso (mismos colores que el prototipo) */
.st { font-size: 12px; font-weight: 600; padding: 3px 10px; }
.st-sin_documentos { background: var(--crit-soft); color: var(--crit); }
.st-documentacion_incompleta { background: var(--warn-soft); color: var(--warn); }
.st-listo_para_generar { background: var(--brand-soft); color: var(--brand); }
.st-generado_con_pendientes, .st-generado { background: var(--ok-soft); color: var(--ok); }
.st-enviado_dd { background: color-mix(in srgb, var(--navy) 10%, var(--surface)); color: var(--navy); }
:root[data-theme="dark"] .st-generado, :root[data-theme="dark"] .st-generado_con_pendientes { color: var(--ok); }
.viz, :root[data-theme="dark"] .viz { --st-1: var(--s3); --st-2: var(--s2); --st-3: var(--s1); --serie: var(--brand); }
.progress { background: var(--surface-2); }
.progress > span { background: var(--ok); }
.toast { background: var(--ink); color: var(--bg); border-radius: 8px; }
.toast.error { background: var(--crit); color: #fff; }
.tip { background: var(--ink); color: var(--bg); }
.page-head h1 { font-size: 1.5rem; }
.page-head p, .muted { color: var(--muted); }
.footer-note { color: var(--muted); }

/* Logo en modo oscuro: sobre fondo blanco, como en el prototipo */
:root[data-theme="dark"] .side-logo img.logo-light { display: block; background: #fff; border-radius: 8px; padding: 4px 6px; height: 36px; }
:root[data-theme="dark"] .side-logo img.logo-dark { display: none; }

/* ---------- Estructura: barra lateral fija + barra superior ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; min-width: 0; }
.side-logo { display: inline-flex; padding: 0 8px; }
.side-logo img { height: 30px; width: auto; display: block; }
.nav { display: grid; gap: 2px; overflow-y: auto; overflow-x: hidden; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.nav-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 8px; color: var(--muted);
  font-weight: 500; text-align: left; font-size: 14px; width: 100%; cursor: pointer; text-decoration: none; min-width: 0; }
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item > span:first-of-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.disabled { opacity: 0.55; }
.nav-sec { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; }
.svc-tg .chev { margin-left: auto; transition: transform 0.2s; font-size: 12px; }
.svc-tg[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.svc-tg.in { color: var(--ink); font-weight: 600; }
.subnav { display: grid; gap: 1px; margin: 2px 0 6px 18px; padding-left: 12px; border-left: 1px solid var(--line); min-width: 0; }
.subnav .nav-item { padding: 7px 10px; font-size: 13.5px; }
.nav-badge { margin-left: auto; font-size: 11px; background: var(--accent-soft); color: var(--warn); padding: 1px 7px; border-radius: 99px; font-weight: 600; flex: none; }
.soon-tag { margin-left: auto; font-size: 10px; font-weight: 600; padding: 1px 6px; flex: none; border-radius: 99px; background: var(--warn-soft); color: var(--warn); }
.side-user { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 12px 8px 0; border-top: 1px solid var(--line); min-width: 0; }
.side-user b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { font-size: 12px; color: var(--muted); }
.av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--brand); color: var(--brand-ink); flex: none; }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 12px 24px; }
.top .crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; margin: 0; }
.top .crumbs a { color: var(--brand); }
.top .crumbs b { color: var(--ink); font-weight: 600; }
.top .crumbs .sep { color: var(--muted); }
.top-r { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.user-dd { position: relative; }
.user-dd > summary { list-style: none; cursor: pointer; }
.user-dd > summary::-webkit-details-marker { display: none; }
.user { display: flex; align-items: center; gap: 9px; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 99px;
  padding: 4px 12px 4px 4px; font-size: 13px; color: var(--ink); }
.user-dd .menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); padding: 6px; min-width: 210px; z-index: 40; }
.user-dd .menu a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink); font-size: 13.5px; }
.user-dd .menu a:hover { background: var(--surface-2); }
.user-dd .menu .menu-email { padding: 8px 10px 6px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.content { padding: 24px 24px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 1440px; width: 100%; align-content: start; }
.content > .alert { margin: 0; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-h h1 { font-size: 24px; }
.page-h p { margin: 4px 0 0; color: var(--muted); }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; overflow: visible; }
  .nav-item { width: auto; padding: 7px 10px; }
  .nav-sec, .side-user, .nav .svc-tg { display: none; }
  .nav .subnav { display: contents; }
  .subnav .nav-item { font-size: 14px; }
  .top { padding: 10px 16px; }
  .content { padding: 18px 16px 36px; }
  .user .u-name { display: none; }
  .user { padding: 4px; }
}

/* ---------- Inicio de sesión dividido ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-side { background: var(--navy); color: #fff; position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; }
.wordmark { display: flex; align-items: center; gap: 12px; }
.logo-tile { background: #fff; border-radius: 10px; padding: 8px 12px; display: inline-flex; }
.logo-tile img { height: 30px; width: auto; display: block; }
.wordmark small { font-weight: 600; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.75; border-left: 1px solid rgba(255, 255, 255, 0.35); padding-left: 10px; }
.login-side h1 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.15; max-width: 15ch; margin-top: 48px; color: #fff; }
.login-side p { max-width: 44ch; opacity: 0.82; font-size: 15px; margin-top: 14px; color: #fff; }
.orbits { position: absolute; right: -180px; bottom: -180px; width: 560px; height: 560px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.14); pointer-events: none; }
.orbits::before, .orbits::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.12); }
.orbits::before { inset: 70px; }
.orbits::after { inset: 150px; border-color: rgba(255, 255, 255, 0.2); }
.planet { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); right: 255px; bottom: 92px; box-shadow: 0 0 0 6px rgba(229, 206, 79, 0.2); }
.login-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: min(400px, 100%); }
.login-card h2 { font-size: 24px; }
.login-card .field { margin: 18px 0 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; flex-wrap: wrap; }
.row-between label { display: flex; gap: 6px; align-items: center; font-weight: 400; color: var(--ink); margin: 0; }
.login-card .btn-block { width: 100%; margin-top: 22px; padding: 12px; }
.fine { font-size: 12px; color: var(--muted); margin-top: 22px; }
.forgot-note { margin-top: 12px; font-size: 13px; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-side { padding: 32px 20px; }
  .login-side h1 { margin-top: 28px; }
  .orbits { width: 360px; height: 360px; right: -140px; bottom: -160px; }
  .planet { display: none; }
}

/* ---------- Inicio ---------- */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 24px; border-radius: 16px; background: var(--navy); color: #fff; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -90px; top: -120px; width: 300px; height: 300px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 0 0 50px rgba(255, 255, 255, 0.03); }
.hero h1 { font-size: clamp(24px, 3vw, 30px); color: #fff; }
.hero p { margin: 6px 0 0; opacity: 0.8; color: #fff; }
.hero .btn { position: relative; z-index: 1; padding: 13px 20px; font-size: 15px; background: var(--accent); color: #1a1a2d; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: -6px; flex-wrap: wrap; }
.sec-h h2 { font-size: 16px; }
.sec-h span { font-size: 12.5px; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-h h2 { font-size: 15px; }
.panel-h span { font-size: 12.5px; color: var(--muted); }
.svc-mini { display: grid; gap: 10px; }
.svc-mini a { display: flex; gap: 12px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px; color: var(--ink); }
.svc-mini a:hover { border-color: var(--brand); color: var(--ink); }
.svc-mini .svc-icon { width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.svc-mini .svc-icon svg { width: 16px; height: 16px; }
.svc-mini b { display: block; font-size: 14px; }
.svc-mini small { color: var(--muted); font-size: 12.5px; }
.svc-mini .chip { margin-left: auto; }
.soon { max-width: 720px; }
.soon ul { color: var(--muted); padding-left: 18px; margin-top: 10px; }
/* Submenú plegable y ajustes de la Fase 1 */
.subnav[hidden] { display: none; }
@media (max-width: 980px) { .nav .subnav[hidden] { display: contents; } }
.top .crumbs .sep { opacity: .6; }
.content > .page-head, .content > .page-h { margin: 0; }
.inline-select { max-width: 100%; color: var(--ink); }
.doc-tipo { width: 100%; text-overflow: ellipsis; }
.recon .badge { white-space: normal; max-width: 100%; line-height: 1.35; }
.recon .badge::before { flex: none; }

/* ---------- Inicio por rol (Fase 2) ---------- */
.att { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .att { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .att { grid-template-columns: 1fr; } }
.att-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 6px;
  border-left: 4px solid var(--c, var(--brand)); transition: box-shadow 0.15s, transform 0.15s; color: var(--ink); align-content: start; }
.att-card:hover { box-shadow: 0 6px 20px rgba(26, 26, 45, 0.08); transform: translateY(-1px); color: var(--ink); }
.att-card b { font-size: 28px; line-height: 1; font-weight: 700; }
.att-card .lb { font-weight: 600; }
.att-card small { color: var(--muted); font-size: 12.5px; }
.att-card .go { font-size: 12.5px; font-weight: 600; color: var(--brand); }
.att-card.zero { --c: var(--ok); }
.att-card.zero b { color: var(--ok); }
.nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.nums > div { padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.nums > div:first-child { border-left: 0; }
.nums small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.nums b { font-size: 26px; font-weight: 700; }
.nums em { font-style: normal; font-size: 12px; margin-left: 6px; font-weight: 600; }
.nums em.up { color: var(--ok); }
.nums em.down { color: var(--crit); }
@media (max-width: 820px) {
  .nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nums > div:nth-child(3) { border-left: 0; }
  .nums > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.recent { display: grid; }
.recent a { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; text-align: left; border-bottom: 1px solid var(--line);
  padding: 12px 4px; color: var(--ink); }
.recent a:last-child { border-bottom: 0; }
.recent a:hover { background: var(--surface-2); color: var(--ink); }
.recent b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent small { color: var(--muted); font-size: 12px; }
@media (max-width: 600px) { .recent a { grid-template-columns: minmax(0, 1fr) auto; } .recent .chip { display: none; } }
.filtro-especial { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.filtro-especial a { font-weight: 600; }
/* ---------- Panel DDA y listas de casos (Fase 3) ---------- */
.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; }
.pkpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .pkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .pkpis { grid-template-columns: minmax(0, 1fr); } }
.pkpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 4px; color: var(--ink); align-content: start; }
a.pkpi:hover { border-color: var(--brand); color: var(--ink); }
.pkpi small { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.pkpi b { font-size: 30px; line-height: 1.1; font-weight: 700; }
.pkpi .sub { font-size: 12.5px; color: var(--muted); }
.pkpi .sub em, .rank-row .val small { font-style: normal; font-weight: 600; }
em.up, small.up { color: var(--ok); }
em.down, small.down { color: var(--crit); }
.g2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.g2.solo { grid-template-columns: minmax(0, 1fr); }
.g2b { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .g2, .g2b { grid-template-columns: minmax(0, 1fr); } }
.panel .legend { margin: 0; font-size: 12px; color: var(--muted); gap: 12px; }
.panel .foot { font-size: 12.5px; margin: 12px 0 0; }
.resp { display: grid; gap: 4px; max-height: 520px; overflow: auto; padding-right: 4px; }
.resp-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 28px; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 6px; color: var(--ink); }
.resp-row:hover { background: var(--surface-2); color: var(--ink); }
.resp-row .nm { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resp-row .ct { font-weight: 600; text-align: right; font-size: 13px; }
.pstack { display: flex; gap: 2px; height: 14px; }
.pstack > i { display: block; height: 100%; min-width: 3px; }
.pstack > i:first-child { border-radius: 3px 0 0 3px; }
.pstack > i:last-child { border-radius: 0 3px 3px 0; }
.pstack > i:only-child { border-radius: 3px; }
@media (max-width: 520px) { .resp-row { grid-template-columns: 96px minmax(0, 1fr) 24px; } }
.pseg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pseg button { border: 0; background: var(--surface); padding: 5px 10px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.pseg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.rank { display: grid; gap: 2px; }
.rank-row { display: grid; grid-template-columns: 22px 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-row.yo { background: var(--brand-soft); border-radius: 8px; }
.pos { font-weight: 800; color: var(--muted); text-align: center; }
.rank-row:nth-child(-n+3) .pos { color: var(--accent-ink); }
.rank-row .who { min-width: 0; }
.rank-row .who b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); margin-top: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.rank-row .val { text-align: right; font-weight: 700; font-size: 16px; }
.rank-row .val small { display: block; font-size: 11.5px; }
.state-bar { display: flex; gap: 2px; height: 22px; margin: 6px 0 12px; }
.state-bar i { display: block; min-width: 3px; }
.state-bar i:first-child { border-radius: 6px 0 0 6px; }
.state-bar i:last-child { border-radius: 0 6px 6px 0; }
.state-bar i:only-child { border-radius: 6px; }
.state-list { display: grid; gap: 8px; }
.state-list div { display: flex; justify-content: space-between; font-size: 13px; gap: 10px; }
.state-list .sw { margin-right: 8px; vertical-align: -1px; }
.trend svg { width: 100%; height: auto; display: block; overflow: visible; }
.trend text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.trend .grid { stroke: var(--line); }
.trend .area { fill: var(--brand); opacity: 0.12; }
.trend .line { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linejoin: round; }
.trend .last { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.trend .last-lbl { fill: var(--ink); font-weight: 600; font-size: 12px; }
.trend .hit { fill: transparent; }
.trend .hit:hover { fill: color-mix(in srgb, var(--brand) 8%, transparent); }

/* Filtros de la lista */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filtros .input { width: auto; min-width: 0; padding: 8px 10px; }
.filtros .buscar { flex: 1 1 260px; }
.filtros .cnt { font-size: 13px; }
.filter-chip { display: inline-flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); }
.filter-chip:hover { color: var(--brand); filter: brightness(0.97); }
@media (max-width: 600px) { .filtros .input { flex: 1 1 100%; } }

/* Tabla de casos */
.ctable-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.ctable { width: 100%; border-collapse: collapse; min-width: 900px; font-size: 13.5px; }
.ctable th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); text-align: left; font-weight: 600; padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ctable td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ctable tbody tr:hover { background: var(--surface-2); }
.ctable tbody tr:last-child td, .ctable tbody tr:has(+ tr.vacio[hidden]) td { border-bottom: 0; }
.ctable td.emp { min-width: 250px; }
.ctable .emp-name { display: inline; font-weight: 600; color: var(--ink); }
.ctable .emp-name:hover { color: var(--brand); }
.ctable .emp .mono { display: block; margin-top: 2px; }
.ctable td.act { text-align: right; }
.ctable tr[hidden] { display: none; }
.who-cell { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.dchips { display: flex; gap: 4px; flex-wrap: wrap; max-width: 130px; }
.prog { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.prog .meter { flex: 1; margin: 0; height: 7px; }
.prog .meter i { background: var(--ok); }
.prog .meter.mid i { background: var(--accent); }
.prog .meter.low i { background: var(--crit); }
.prog .num { font-size: 12.5px; min-width: 32px; text-align: right; }
.dias { white-space: nowrap; }
.dias.hot { color: var(--crit); font-weight: 600; }
.empty-row { text-align: center; color: var(--muted); padding: 28px !important; }
.dupflag { font-size: 11px; font-weight: 700; color: var(--warn); background: var(--warn-soft); padding: 1px 7px; border-radius: 99px; margin-left: 6px; letter-spacing: 0.02em; white-space: nowrap; }
.panel .ctable-wrap { margin: 0 -1px -1px; }
@media (max-width: 700px) {
  .ctable-wrap { border: 0; background: none; overflow: visible; }
  .panel .ctable-wrap { margin: 0; }
  .ctable { min-width: 0; display: block; }
  .ctable thead { display: none; }
  .ctable tbody { display: grid; gap: 10px; }
  .ctable tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
  .ctable tbody tr:hover { background: var(--surface); }
  .ctable td { display: block; padding: 0; border: 0 !important; min-width: 0; }
  .ctable td.emp { grid-column: 1 / -1; min-width: 0; }
  .ctable td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
  .ctable td.act { grid-column: 1 / -1; text-align: left; }
  .ctable td.act .btn { width: 100%; justify-content: center; }
  .ctable td.dias { text-align: left; }
  .ctable tr.vacio { display: block; }
  .ctable tr.vacio[hidden] { display: none; }
  .who-cell { white-space: normal; }
  .prog { min-width: 0; }
}
/* ---------- Nuevo caso en 4 pasos y avisos (Fase 4) ---------- */
.steps { display: flex; gap: 8px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.steps span { display: inline-flex; align-items: center; gap: 6px; }
.steps i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); }
.steps .on i { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.steps .on { color: var(--ink); font-weight: 600; }
.steps .hecho i { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.bigdrop { border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); border-radius: 14px;
  padding: 44px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; transition: background 0.15s, border-color 0.15s; cursor: pointer; margin: 0; }
.bigdrop:hover, .bigdrop.over, .bigdrop:focus-visible { background: var(--brand-soft); border-color: var(--brand); }
.bigdrop .ic { width: 56px; height: 56px; border-radius: 14px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.bigdrop b { font-size: 17px; color: var(--ink); }
.bigdrop .muted { font-size: 13px; }
.nv-nota { font-size: 12.5px; margin: 12px 0 0; }
.filelist { display: grid; gap: 8px; }
.file { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.file.err { border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); }
.file .nm { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.file small { display: block; color: var(--muted); font-size: 12px; }
.doc-ic { width: 34px; height: 38px; border-radius: 5px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 9.5px; font-weight: 700; flex: none; font-family: var(--font-mono); overflow: hidden; }
.mini-spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; }
.nv-docacts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nv-acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
#paso2 .nv-acts { margin-top: 14px; }
#paso3 { display: grid; gap: 16px; }
#paso3[hidden] { display: none; }
.nv-confirmar { display: grid; gap: 16px; }
.casename { font-size: 18px; font-weight: 700; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.casename small { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.detect { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .detect { grid-template-columns: minmax(0, 1fr); } }
.detect .field { margin: 0; }
.detect .src { font-size: 11.5px; color: var(--muted); }
.nv-resp { margin: 0; max-width: 340px; }
.nv-cnt { font-size: 12.5px; margin-left: 6px; align-self: center; }
.dupbox { display: grid; gap: 10px; }
.dupbox h3 { font-size: 15px; display: flex; gap: 8px; align-items: center; margin: 0; }
.dupbox p { margin: 0; font-size: 13.5px; }
.dupbox .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.dupbox .motivo .field { margin: 0; }
.dupbox textarea { width: 100%; min-height: 70px; resize: vertical; }
.alert-crit { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 35%, var(--line)); color: var(--ink); }
.alert h3 { font-size: 15px; margin: 0 0 4px; }
.alert > p { margin: 0; }
.dupcard { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; flex-wrap: wrap; font-size: 13.5px; }
.dupcard .who-cell b { font-weight: 600; }
.nv-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--bg); padding: 10px 16px;
  border-radius: 10px; font-size: 13.5px; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }
.nv-toast.error { background: var(--crit); color: #fff; }

/* Avisos en la barra superior */
.bell { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.bell svg { width: 16px; height: 16px; }
.bell-n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--crit); color: #fff;
  font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.avisos-menu { width: min(360px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; }
.avisos-menu .aviso { display: grid; gap: 2px; padding: 9px 10px; border-radius: 8px; font-size: 13px; line-height: 1.4; }
.avisos-menu .aviso.nuevo { background: var(--brand-soft); font-weight: 500; }
.avisos-menu .aviso small { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.avisos-menu .aviso-vacio { padding: 8px 10px; margin: 0; font-size: 13px; }
.avisos-menu form { padding: 6px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
@media (max-width: 520px) { .avisos-dd .menu { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; } }.nv-confirmar .dchips { max-width: none; align-items: center; }
.avisos-dd .menu a.aviso { display: grid; gap: 2px; }
.avisos-dd .menu a.aviso small { display: block; }

/* ---------- Ficha del caso DDA (Fase 5) ---------- */
.dcase-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.dcase-head h1 { font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.ch-main { min-width: 0; flex: 1 1 360px; }
.ch-rnc { color: var(--muted); font-weight: 500; }
.ch-rnc .mono { font-size: 16px; }
.dcase-meta { display: flex; gap: 10px 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 8px; align-items: center; }
.dcase-meta .inline-select { padding: 3px 26px 3px 10px; font-size: 13px; }
.dcase-meta .inline-select:disabled { opacity: 1; border-color: transparent; background: transparent; padding-left: 0; cursor: default; color: var(--ink); -webkit-appearance: none; appearance: none; }
.ch-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.dcase-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .dcase-grid { grid-template-columns: minmax(0, 1fr); } }
.dcase-out { display: grid; gap: 16px; min-width: 0; }
.dcase-out > div:empty { display: none; }
.dcase-docs { display: grid; gap: 10px; }
.dcase-docs .panel-h { margin-bottom: 4px; }
.docs { display: grid; gap: 8px; }
.doc { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.doc-m { min-width: 0; display: grid; gap: 3px; }
.doc-m b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-m small { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.doc-m small.err { color: var(--crit); }
.doc-st { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.doc-st .chip { font-size: 11.5px; padding: 2px 8px; }
.doc-st .chip .mini-spin { width: 11px; height: 11px; border-width: 2px; }
.doc-st .chip:has(.mini-spin)::before { display: none; }
.doc-tipo-l { margin: 2px 0 0; }
.doc-tipo { font-size: 12px; padding: 3px 24px 3px 8px; }
.doc-a { display: flex; gap: 2px; }
.doc-a .icon-btn { width: 30px; height: 30px; }
.drop { border: 1.5px dashed var(--line); border-radius: 8px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.drop:hover, .drop.drag, .drop:focus-visible { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); }
.drop[hidden] { display: none; }
.btn-block { width: 100%; justify-content: center; }
.gen-note { font-size: 12px; margin: 0; }
.danger-link { color: var(--crit); font-size: 12.5px; font-weight: 500; }
.center { display: grid; place-items: center; text-align: center; min-height: 220px; color: var(--muted); }
.center .ink, .ink { color: var(--ink); }
.center-sm { display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--muted); padding: 22px; }
.cnotif { border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); border-radius: var(--r); overflow: hidden; }
.notif-h { display: flex; gap: 14px; align-items: center; padding: 14px 16px; flex-wrap: wrap; }
.notif-h .t { flex: 1 1 280px; min-width: 0; }
.notif-h strong { display: block; }
.notif-h span { font-size: 13.5px; }
.cnotif .bar { height: 8px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-radius: 99px; overflow: hidden; margin-top: 8px; max-width: 440px; }
.cnotif .bar i { display: block; height: 100%; background: var(--ok); }
.toggle .chev { transition: transform 0.2s; display: inline-block; }
.toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.cnotif .dd { border-top: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--surface); padding: 14px 16px; display: grid; gap: 10px; }
.cnotif .dd h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin: 0; }
.csug { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.csug summary { list-style: none; display: flex; gap: 12px; align-items: center; padding: 10px 12px; cursor: pointer; }
.csug summary::-webkit-details-marker { display: none; }
.csug .n { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.csug .n.off { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.csug .tx { flex: 1; min-width: 0; }
.csug .tx b { display: block; font-size: 13.5px; }
.csug .tx small { color: var(--muted); font-size: 12px; }
.csug .plus { font-weight: 600; color: var(--brand); white-space: nowrap; font-size: 13px; }
.csug .body { padding: 0 12px 12px 50px; display: grid; gap: 10px; }
.csug ul, .grp ul { margin: 0; padding-left: 16px; color: var(--muted); font-size: 13px; }
.csug ul { columns: 2; column-gap: 24px; }
@media (max-width: 600px) { .csug ul { columns: 1; } .csug .body { padding-left: 12px; } }
.grp { border: 1px solid var(--line); border-radius: 8px; }
.grp summary { padding: 10px 12px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.grp ul { padding: 0 12px 12px 30px; }
.sendbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sendbar > div { flex: 1 1 300px; }
.sendbar p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.sendbar .warn-t { color: var(--warn); font-weight: 500; }
#envioBox { display: grid; gap: 12px; }
#envioBox .field, .lock-form .field { margin: 0; }
#envioBox textarea, .lock-form textarea { width: 100%; resize: vertical; }
.lock { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--navy) 6%, var(--surface)); border: 1px solid var(--line); }
:root[data-theme="dark"] .lock { background: #1b1e4a; }
.lock .t { flex: 1 1 260px; display: grid; gap: 2px; }
.lock b { display: block; }
.lock-form { flex: 1 1 100%; display: grid; gap: 8px; }
.lock-form .acts, #envioBox .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.pv-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ctabs { border-bottom: 1px solid var(--line); margin-bottom: 14px; gap: 2px; }
.ctabs .tab { border: 0; background: none; padding: 9px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; font-size: 13.5px; }
.ctabs .tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.ctabs .tab .c { font-size: 11px; margin-left: 5px; color: var(--warn); font-weight: 600; }
.campos-bar { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.hojas { display: flex; gap: 6px; flex-wrap: wrap; }
.hojas .hoja { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.hojas .hoja.on { background: var(--brand-soft); color: var(--brand); border-color: transparent; font-weight: 600; }
.hojas .hoja small { margin-left: 5px; font-size: 11px; color: var(--warn); font-weight: 600; }
.hojas .hoja small.na { color: var(--muted); font-weight: 400; }
.fields { display: grid; gap: 14px; }
.fsec h3 { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 6px; }
.cfield { border-radius: 6px; }
.cfield > summary { list-style: none; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 10px; cursor: pointer; border-radius: 6px; }
.cfield > summary::-webkit-details-marker { display: none; }
.cfield > summary:hover { background: var(--surface-2); }
.cfield .ic { font-weight: 700; text-align: center; }
.cfield.ok .ic { color: var(--ok); }
.cfield.validar .ic { color: var(--accent-ink); }
.cfield.pend { background: color-mix(in srgb, var(--pend) 32%, var(--surface)); }
.cfield.pend > summary:hover { background: color-mix(in srgb, var(--pend) 45%, var(--surface)); }
.cfield.pend .ic { color: var(--warn); }
.cfield.pend.alta .ic { color: var(--crit); }
.cfield.na .ic { color: var(--muted); }
.cfield .f-l { font-size: 13.5px; }
.cfield > summary small { color: var(--muted); font-size: 12px; text-align: right; }
.cfield[open] { background: var(--surface-2); }
.cfield.pend[open] { background: color-mix(in srgb, var(--pend) 22%, var(--surface)); }
.f-body { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; padding: 4px 12px 12px 42px; font-size: 13px; }
.f-body .f-k { color: var(--muted); font-size: 12px; font-weight: 600; }
.f-body .f-v { white-space: pre-wrap; overflow-wrap: anywhere; }
.f-body .f-acts, .f-body .f-edit-slot { grid-column: 1 / -1; }
.f-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.f-body .chip { font-size: 11.5px; padding: 1px 8px; }
.cfield .f-edit { display: grid; gap: 8px; margin: 4px 0 0; }
.cfield .f-edit .input { max-width: 460px; }
.multi { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.danger-t { color: var(--crit) !important; }
@media (max-width: 600px) {
  .f-body { grid-template-columns: minmax(0, 1fr); padding-left: 12px; }
  .cfield > summary { grid-template-columns: 18px minmax(0, 1fr); }
  .cfield > summary small { grid-column: 2; text-align: left; }
}
.hist { display: grid; gap: 2px; }
.hist-row { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.hist-row:last-child { border-bottom: 0; }
.hist-row b { display: block; font-weight: 600; }
.hist-row small { color: var(--muted); font-size: 12px; }
.hist-row p { margin: 4px 0 0; color: var(--ink); overflow-wrap: anywhere; }
.hist-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--s3); margin-top: 5px; }
.hist-dot.enviado, .hist-dot.excepcion_aprobada { background: var(--ok); }
.hist-dot.excepcion_rechazada, .hist-dot.reabierto { background: var(--crit); }
.hist-dot.excepcion_solicitada, .hist-dot.duplicado_continuado, .hist-dot.duplicado_avisado { background: var(--accent); }
.hist-dot.caso_creado, .hist-dot.documentos_agregados, .hist-dot.reasignado { background: var(--brand); }
.pages { background: var(--surface-2); border-radius: 8px; padding: 14px; max-height: 72vh; overflow: auto; }
.pages img { max-width: 860px; margin: 0 auto 14px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); }
.note { font-size: 12.5px; color: var(--muted); text-align: center; margin: 0 0 12px; }#lockBox:empty { display: none; }
.doc-tipo { max-width: 100%; color: var(--muted); }
.ctabs { overflow: visible; flex-wrap: wrap; }

/* ---------- Usuarios y Configuración (Fase 6) ---------- */
.cfg { display: grid; gap: 4px; max-width: 640px; }
.cfg .field { margin: 0 0 14px; }
.cfg .hint { font-size: 12.5px; color: var(--muted); }
.cfg-acts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.cred-box { display: grid; gap: 8px; }
.cred-box h3 { margin: 0; font-size: 15px; }
.cred-box p { margin: 0; }
.cred-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; font-size: 13.5px; overflow-wrap: anywhere; }
.cred-box .acts { display: flex; gap: 8px; }
.cred { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; justify-self: start; }
.add-user { display: grid; gap: 4px; }
.add-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.add-grid .field { margin: 0 0 14px; }
.add-grid .srv, .add-grid .add-acts { grid-column: 1 / -1; }
.add-acts { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 700px) { .add-grid { grid-template-columns: minmax(0, 1fr); } }
fieldset.srv { border: 0; padding: 0; display: grid; gap: 6px; }
fieldset.srv legend { margin-bottom: 4px; padding: 0; }
.utable { min-width: 820px; }
.utable .who-cell b { display: block; font-weight: 600; }
.utable .u-mail { display: block; white-space: normal; overflow-wrap: anywhere; }
.utable td.emp { min-width: 220px; }
.u-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; }
.u-acts form { margin: 0; }
.perm-menu { width: 300px; padding: 14px !important; text-align: left; }
.perm-menu .field { margin: 0 0 12px; }
@media (max-width: 700px) {
  .utable td.act { text-align: left; }
  .u-acts { justify-content: flex-start; }
  .perm-dd .perm-menu { position: static; width: auto; box-shadow: none; margin-top: 8px; }
  .perm-dd[open] { flex-basis: 100%; }
}@media (max-width: 700px) { .ctable.utable { min-width: 0; } .utable td.emp { min-width: 0; } }

/* ---------- Mantenimiento PJ (servicio en desarrollo) ---------- */
.mpj { display: grid; gap: 12px; max-width: 760px; justify-items: start; }
.mpj h1 { font-size: 22px; margin: 4px 0 0; }
.mpj h2 { font-size: 15px; margin: 10px 0 0; }
.mpj p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.mpj .mpj-lead { color: var(--ink); font-size: 15px; }
.mpj ul { margin: 0; color: var(--muted); padding-left: 18px; line-height: 1.7; }
.mpj .btn { margin-top: 6px; }
.mpj-flujo { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; counter-reset: none; }
.mpj-flujo li { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface-2); position: relative; }
.mpj-flujo li:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); color: var(--brand); font-weight: 700; background: var(--surface); line-height: 1; padding: 2px 0; }
.mpj-flujo .n { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.mpj-flujo b { display: block; font-size: 13.5px; }
.mpj-flujo small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.45; }
@media (max-width: 760px) {
  .mpj-flujo { grid-template-columns: minmax(0, 1fr); }
  .mpj-flujo li:not(:last-child)::after { content: "↓"; right: auto; left: 22px; top: auto; bottom: -13px; transform: none; padding: 0 2px; }
}