/* ============================================================
   Barisch & Savino — hoja de estilos (tokens OKLCh
   acromáticos + un solo acento; tema claro/oscuro por variables)
   ============================================================ */
:root {
  /* Base ZINC (neutro). El fondo es gris suave para que las tarjetas blancas resalten. */
  --bg: oklch(0.955 0 0);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0 0);
  --border: oklch(0.912 0 0);
  --border-strong: oklch(0.84 0 0);
  --text: oklch(0.21 0 0);
  --text-soft: oklch(0.52 0 0);
  /* Acento único (lo pisa el color elegido en Configuración) */
  --primary: #4f46e5;
  --primary-dark: color-mix(in oklch, var(--primary) 82%, black);
  --primary-soft: color-mix(in oklch, var(--primary) 12%, var(--surface));
  --on-primary: #ffffff;
  --danger: oklch(0.577 0.215 27);
  --danger-soft: oklch(0.965 0.02 25);
  --success: oklch(0.587 0.15 152);
  --success-soft: oklch(0.965 0.03 152);
  --warning: oklch(0.646 0.15 75);
  --warning-soft: oklch(0.973 0.04 90);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px oklch(0 0 0 / .05);
  --shadow-lg: 0 8px 28px oklch(0 0 0 / .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: oklch(0.178 0 0);
  --surface: oklch(0.225 0 0);
  --surface-2: oklch(0.262 0 0);
  --border: oklch(0.32 0 0);
  --border-strong: oklch(0.42 0 0);
  --text: oklch(0.93 0 0);
  --text-soft: oklch(0.68 0 0);
  --primary: #7c83ff;
  --primary-dark: color-mix(in oklch, var(--primary) 80%, white);
  --primary-soft: color-mix(in oklch, var(--primary) 26%, var(--surface));
  --danger: oklch(0.7 0.17 25);
  --danger-soft: oklch(0.26 0.04 25);
  --success: oklch(0.74 0.14 152);
  --success-soft: oklch(0.26 0.04 152);
  --warning: oklch(0.78 0.13 85);
  --warning-soft: oklch(0.26 0.04 90);
  --shadow: 0 1px 2px oklch(0 0 0 / .4);
  --shadow-lg: 0 8px 28px oklch(0 0 0 / .55);
}

/* ===== Paleta base alternativa: SLATE (leve azulado, estilo shadcn) ===== */
[data-base="slate"] {
  --bg: oklch(0.955 0.006 255);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.968 0.006 255);
  --border: oklch(0.912 0.01 255);
  --border-strong: oklch(0.84 0.014 255);
  --text: oklch(0.23 0.03 260);
  --text-soft: oklch(0.52 0.02 260);
}
[data-base="slate"][data-theme="dark"] {
  --bg: oklch(0.21 0.02 260);
  --surface: oklch(0.26 0.02 260);
  --surface-2: oklch(0.3 0.02 260);
  --border: oklch(0.36 0.02 260);
  --border-strong: oklch(0.45 0.02 260);
  --text: oklch(0.94 0.01 260);
  --text-soft: oklch(0.7 0.015 260);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; color: var(--text);
  background: var(--bg); line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Estructura: sidebar + main ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex-shrink: 0; background: var(--bg); color: var(--text-soft);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  transition: width .25s ease;
}
.sidebar-top { display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.sidebar-brand {
  display: flex; align-items: center; gap: 11px; padding: 17px 16px; color: var(--text); flex: 1; min-width: 0;
}
.collapse-btn { background: none; border: none; color: var(--text-soft); cursor: pointer; padding: 8px 12px; }
.collapse-btn:hover { color: var(--text); }
.app-shell.nav-mini .collapse-btn svg { transform: rotate(180deg); }
.sidebar-brand .mark {
  background: var(--primary); color: #fff; font-weight: 800; font-size: 14px;
  width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  letter-spacing: .5px; flex-shrink: 0;
}
.sidebar-brand .txt b { display: block; font-size: 14px; line-height: 1.15; color: var(--text); }
.sidebar-brand .txt small { color: var(--text-soft); font-size: 10.5px; letter-spacing: .4px; }

.sidebar-nav { padding: 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.sidebar-nav .group-label { color: var(--text); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .6px; padding: 14px 12px 6px; font-weight: 800; opacity: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px;
  color: var(--text-soft); font-weight: 500; font-size: 14px;
  position: relative; transition: background .15s ease, color .15s ease;
}
/* Hover suave: un velo tenue neutro (se adapta a claro/oscuro), que no moleste */
.nav-item:hover { background: color-mix(in oklch, var(--text) 6%, transparent); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
/* Barra de acento del item seleccionado (se adapta sola a claro/oscuro vía --primary) */
.nav-item.active::before {
  content: ""; position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.app-shell.nav-mini .nav-item.active::before { left: 0; height: 16px; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item .count { margin-left: auto; background: var(--surface-2); color: var(--text-soft);
  font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.nav-item.active .count { background: var(--primary); color: #fff; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-mini { display: flex; align-items: center; gap: 9px; padding: 6px 8px; }
.user-mini .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.user-mini .info { overflow: hidden; }
.user-mini .info b { display: block; font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini .info small { color: var(--text-soft); font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }

/* ---------- Topbar ---------- */
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.topbar .hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 4px; }
.topbar .page-title { font-size: 16px; font-weight: 700; }
.topbar .grow { flex: 1; }
.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft);
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }

.container { max-width: 1560px; width: 100%; margin: 0 auto; padding: 22px 30px;
  transition: max-width .25s ease; }
/* Menú achicado: el contenido aprovecha todo el ancho */
.app-shell.nav-mini .container { max-width: 100%; }

/* Encabezado + pestañas del caso fijos al hacer scroll (bajo el topbar de 60px) */
.caso-sticky { position: sticky; top: 60px; z-index: 20; background: var(--bg);
  padding-top: 12px; box-shadow: 0 8px 8px -8px rgba(0,0,0,.10); }
.caso-sticky .page-head { margin-bottom: 8px; }
.caso-sticky .tabs { margin-bottom: 0; }
@media print { .caso-sticky { position: static; box-shadow: none; } }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; }
.page-head .spacer { flex: 1; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: all .12s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-dark); }

/* Muestras de temas prearmados */
.tema-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.tema-swatch:hover { transform: scale(1.1); border-color: var(--text-soft); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Filtros ---------- */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filtros .campo { display: flex; flex-direction: column; gap: 4px; }
.filtros label { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.filtros .grow { flex: 0 1 360px; min-width: 200px; }
.check-inline { flex-direction: row !important; align-items: center; gap: 6px; height: 38px; }

/* ---------- Inputs ---------- */
.input, select.input {
  width: 100%; height: var(--ctl-h); padding: 4px 11px; font-size: 14px; font-family: var(--font);
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text);
}
textarea.input {
  width: 100%; padding: 7px 11px; font-size: 14px; font-family: var(--font);
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text);
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.input { resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

/* ---------- Tabla / Grilla ---------- */
.tabla-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.grilla { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grilla thead th {
  text-align: left; background: var(--surface-2); color: var(--text-soft); font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.grilla tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grilla tbody tr:hover { background: var(--primary-soft); cursor: pointer; }
table.grilla tbody tr:last-child td { border-bottom: none; }
/* Cualquier cosa clickeable: manito + hover suave que contrasta (como la tabla de clientes) */
[onclick] { cursor: pointer; }
.lista-mov tbody tr[onclick]:hover,
table tbody tr[onclick]:hover { background: var(--primary-soft); cursor: pointer; }
.carpeta-num { font-weight: 700; color: var(--primary); }
.muted { color: var(--text-soft); }
.tabla-vacia { padding: 40px 20px; text-align: center; color: var(--text-soft);
  font-size: 14px; line-height: 1.5; }
.tabla-vacia::before { content: ""; display: block; width: 30px; height: 30px;
  margin: 0 auto 10px; border-radius: 8px; background: var(--surface-2);
  border: 2px dashed var(--border-strong); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 600; background: var(--surface-2); color: var(--text-soft); white-space: nowrap; border: 1px solid var(--border); }
.badge-alarm { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-sub { background: var(--primary-soft); color: var(--primary); border-color: transparent; }

/* ---------- Formularios ---------- */
.form-section { margin-bottom: 20px; }
.form-section > h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft);
  margin: 0 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--border); font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; position: relative; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-soft); }
.field .errorlist { color: var(--danger); font-size: 12px; margin: 2px 0 0; padding-left: 16px; }
.field .helptext { font-size: 11px; color: var(--text-soft); }

.checklist { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px 12px; }
.checklist label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
.checklist input { width: 16px; height: 16px; accent-color: var(--primary); }

.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-actions .spacer { flex: 1; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { background: none; border: none; padding: 11px 16px; font-size: 14px; font-weight: 600;
  color: var(--text-soft); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Detalle ---------- */
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 7px 14px; }
.dl dt { color: var(--text-soft); font-weight: 600; font-size: 13px; }
.dl dd { margin: 0; }
.doc-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.doc-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); }
.doc-chip.on { background: var(--success-soft); color: var(--success); border-color: transparent; }

/* ---------- Movimientos / listas ---------- */
.lista-mov { width: 100%; border-collapse: collapse; font-size: 13px; }
.lista-mov th { text-align: left; color: var(--text-soft); font-size: 12px; text-transform: uppercase; padding: 9px 8px; border-bottom: 1px solid var(--border); }
.lista-mov td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }

/* ---------- Galería de imágenes + lightbox ---------- */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.galeria .thumb { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; position: relative; }
.galeria .thumb img { width: 100%; height: 130px; object-fit: cover; display: block; transition: transform .2s; }
.galeria .thumb:hover img { transform: scale(1.04); }
.galeria .thumb .cap { padding: 7px 9px; font-size: 12px; color: var(--text-soft); }
.galeria .thumb .cap b { color: var(--text); display: block; word-break: break-all; font-weight: 600; }
/* Documentación por ítem */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.doc-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface); }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.doc-name { font-weight: 600; font-size: 13.5px; }
.doc-files { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 9px; }
.doc-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 7px; cursor: pointer; border: 1px solid var(--border); }
.doc-file { font-size: 12px; word-break: break-all; }
.doc-del { color: var(--danger); font-size: 13px; text-decoration: none; font-weight: 700; }
.doc-upload { display: flex; gap: 6px; align-items: center; }
.doc-upload input[type=file] { font-size: 12px; padding: 5px 7px; flex: 1; min-width: 0; }

.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.doc-row .ico { font-size: 20px; }

.lightbox { position: fixed; inset: 0; background: rgba(5,8,18,.88); z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 30px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lightbox .close { position: absolute; top: 18px; right: 22px; color: #fff; font-size: 30px; cursor: pointer; background: none; border: none; }

/* ---------- Alertas ---------- */
.alertas { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.alerta { display: flex; align-items: center; gap: 11px; padding: 11px 15px; border-radius: 10px;
  font-size: 14px; text-decoration: none; border: 1px solid transparent; }
.alerta:hover { text-decoration: none; filter: brightness(.98); }
.alerta b { font-weight: 700; }
.alerta .ai { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center;
  justify-content: center; font-weight: 800; flex-shrink: 0; }
.alerta.warn { background: var(--warning-soft); color: var(--warning); }
.alerta.warn .ai { background: var(--warning); color: #fff; }
.alerta.danger { background: var(--danger-soft); color: var(--danger); }
.alerta.danger .ai { background: var(--danger); color: #fff; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: block; }
.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat .num { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat .lbl { color: var(--text-soft); font-size: 13px; margin-top: 6px; }
.stat.accent .num { color: var(--primary); }
.stat.danger .num { color: var(--danger); }
.estado-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.estado-pill { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.estado-pill:hover { border-color: var(--primary); text-decoration: none; }
.estado-pill .e { font-weight: 600; color: var(--text); font-size: 13.5px; }
.estado-pill .n { font-weight: 800; color: var(--primary); font-size: 17px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); font-weight: 700; margin: 4px 0 12px; }

/* ---------- Autocomplete ---------- */
.ac-box { position: absolute; top: 100%; left: 0; right: 0; z-index: 50; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 9px; box-shadow: var(--shadow-lg); margin-top: 3px; max-height: 260px; overflow-y: auto; }
.ac-item { padding: 9px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.ac-item:hover { background: var(--primary-soft); }
.ac-nombre { font-weight: 600; font-size: 13px; }
.ac-sub { font-size: 12px; color: var(--text-soft); }

/* ---------- Alerts ---------- */
.messages { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.alert { padding: 11px 15px; border-radius: 9px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error, .alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--primary-soft); color: var(--primary); }

/* ---------- Atajos (ayuda) ---------- */
kbd { background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 12px; font-family: var(--font); color: var(--text); }

/* ---------- Login ---------- */

/* ---------- Manual de uso ---------- */
.manual { max-width: 860px; }
.manual h2 { font-size: 19px; margin: 28px 0 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.manual h2.first { border-top: none; padding-top: 0; }
.manual h3 { font-size: 15px; margin: 18px 0 8px; }
.manual p { margin: 8px 0; }
.manual ol, .manual ul { margin: 8px 0 8px 4px; padding-left: 22px; }
.manual li { margin: 5px 0; }
.manual .tip { background: var(--primary-soft); color: var(--primary); border-radius: 9px; padding: 11px 14px; margin: 12px 0; font-size: 13.5px; }
.manual .toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 14px 0 8px; }
.manual .toc a { padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 13.5px; color: var(--text); }
.manual .toc a:hover { border-color: var(--primary); text-decoration: none; }

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app-shell, .main { display: block; }
  .container { max-width: none; padding: 0; }
  .manual h2 { break-after: avoid; }
  body { background: #fff; }
}

/* ---------- Menú colapsado (solo iconos) — solo en desktop ---------- */
@media (min-width: 901px) {
  .app-shell.nav-mini .sidebar { width: 66px; }
  .app-shell.nav-mini .sidebar-brand .txt,
  .app-shell.nav-mini .sidebar-nav .group-label,
  .app-shell.nav-mini .nav-item .count,
  .app-shell.nav-mini .user-mini .info { display: none; }
  .app-shell.nav-mini .sidebar-top { flex-direction: column; gap: 2px; }
  .app-shell.nav-mini .sidebar-brand { justify-content: center; padding: 14px 0 2px; }
  .app-shell.nav-mini .collapse-btn { padding: 2px 0 10px; }
  .app-shell.nav-mini .nav-item { justify-content: center; gap: 0; font-size: 0; position: relative; }
  .app-shell.nav-mini .nav-item svg { font-size: initial; }
  .app-shell.nav-mini .user-mini { justify-content: center; }
  .app-shell.nav-mini .sidebar-foot form .btn { font-size: 0; padding: 8px 0; }

  /* Cartelito instantáneo con el nombre al pasar el mouse (barra en miniatura). */
  .app-shell.nav-mini .sidebar-nav { overflow: visible; }
  .app-shell.nav-mini .nav-item::after {
    content: attr(title);
    position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    background: var(--text); color: var(--bg);
    font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
    padding: 7px 9px; border-radius: 6px; box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s; z-index: 100;
  }
  .app-shell.nav-mini .nav-item:hover::after { opacity: 1; visibility: visible; }
}

/* ---------- Tour guiado ---------- */
.tour-backdrop { position: fixed; inset: 0; background: rgba(10,14,26,.6); z-index: 200; }
.tour-highlight { position: relative; z-index: 201; box-shadow: 0 0 0 4px var(--primary); border-radius: 8px; }
.tour-pop { position: fixed; z-index: 202; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 16px; width: 290px; max-width: 92vw; }
.tour-pop h4 { margin: 0 0 6px; font-size: 15px; }
.tour-pop p { margin: 0 0 12px; font-size: 13.5px; color: var(--text-soft); }
.tour-pop .row { display: flex; align-items: center; gap: 8px; }
.tour-pop .row .spacer { flex: 1; }
.tour-pop .paso { font-size: 12px; color: var(--text-soft); }

.no-mobile { display: inline-flex; }

/* ---------- Mobile drawer ---------- */
.backdrop { display: none; position: fixed; inset: 0; background: rgba(5,8,18,.5); z-index: 40; }

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .checklist { grid-template-columns: repeat(2, 1fr); }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dt { margin-top: 8px; }

  .no-mobile { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .22s; }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open .backdrop { display: block; }
  .topbar .hamburger { display: inline-flex; }

  table.grilla thead { display: none; }
  table.grilla, table.grilla tbody, table.grilla tr, table.grilla td { display: block; width: 100%; }
  table.grilla tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 11px 13px; background: var(--surface); }
  table.grilla tbody td { border: none; padding: 3px 0; }
  table.grilla tbody td.col-opt { display: none; }
  table.grilla tbody td::before { content: attr(data-label) ": "; font-weight: 600; color: var(--text-soft); }
  table.grilla tbody td.col-cliente { font-size: 15px; font-weight: 700; padding-bottom: 6px; }
  table.grilla tbody td.col-cliente::before { content: ""; }
}

/* ===== extras: CRM pipeline (no usado) ===== */
.pipeline { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
/* Las columnas se reparten el ancho para que entre todo el pipeline en pantalla
   (en pantallas chicas, si no entra, aparece scroll horizontal como respaldo). */
.pipe-col { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
            min-width: 0; flex: 1 1 0; padding: 9px; }
.pipe-head { font-weight: 700; font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.pipe-head .n { background: var(--surface); border: 1px solid var(--border); border-radius: 99px;
                padding: 0 8px; font-size: 12px; color: var(--text-soft); }
.pipe-col.ganado .pipe-head { color: var(--success); }
.pipe-col.perdido .pipe-head { color: var(--text-soft); }
.pipe-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
             padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); }
.pipe-card .nombre { font-weight: 600; }
.input-sm { padding: 4px 8px; font-size: 12px; }
/* Tarjetas/módulos ordenables arrastrando el título (ficha de contacto, etc.) */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px; align-items: start; }
.orden-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; cursor: grab; }
.orden-head .grip { color: var(--text-soft); font-size: 14px; letter-spacing: -2px; user-select: none; }
.orden-card.dragging { opacity: .45; }

/* ===== extras: chat (no usado) ===== */
.chat-card { display: flex; flex-direction: column; max-width: 760px; }
.chat-scroll { padding: 14px; overflow-y: auto; max-height: 55vh; min-height: 220px;
               display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; }
.msg.out { justify-content: flex-end; }
.msg .burbuja { max-width: 78%; padding: 8px 12px; border-radius: 12px; font-size: 14px;
                background: var(--bg-soft); border: 1px solid var(--border); white-space: pre-wrap; }
.msg.out .burbuja { background: var(--primary-soft); border-color: transparent; }
.msg .meta { font-size: 11px; color: var(--text-soft); margin-top: 4px; }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.chat-input .input { flex: 1; }

/* ===== extras: simulador (no usado) ===== */
.telefono { overflow: hidden; }
.telefono-top { background: #075e54; color: #fff; padding: 10px 14px; font-weight: 600;
                border-radius: var(--radius) var(--radius) 0 0; }
[data-theme="dark"] .telefono-top { background: #0b3d36; }

/* ===== Kanban drag & drop ===== */
.pipe-card[draggable="true"] { cursor: grab; }
.pipe-card[draggable="true"]:active { cursor: grabbing; }
.pipe-col.drop-hover { outline: 2px dashed var(--primary); outline-offset: -2px; background: var(--primary-soft); }
.solo-mobile { display: none; }
@media (max-width: 760px) { .solo-mobile { display: block; } .no-mobile { display: none; } }


/* ===== Pulido estilo Zenith ===== */
table.grilla thead th { background: var(--surface-2); }
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 18%, transparent);
}
.card { border: 1px solid var(--border); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-item [data-lucide], .nav-item svg { width: 19px; height: 19px; }
.icon-btn [data-lucide], .icon-btn svg { width: 18px; height: 18px; }


/* ===== Tablas ordenables ===== */
table.grilla thead th { cursor: pointer; user-select: none; white-space: nowrap; }
table.grilla thead th:hover { color: var(--text); }
table.grilla thead th .flecha { opacity: .35; font-size: 9px; margin-left: 5px; }
table.grilla thead th.orden-asc .flecha, table.grilla thead th.orden-desc .flecha { opacity: 1; color: var(--primary); }

/* ===== Menú de usuario (topbar) ===== */
.user-menu { position: relative; }
.avatar-btn { width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary); color: var(--on-primary, #fff); font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; }
.avatar-btn:hover { filter: brightness(1.08); }
.user-pop { position: absolute; right: 0; top: 46px; width: 230px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60; }
.user-pop .up-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-pop .up-head b { display: block; font-size: 13.5px; }
.user-pop .up-head small { color: var(--text-soft); font-size: 11.5px; }
.user-pop a, .user-pop button { display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 12px; border: none; background: none; border-radius: var(--radius-sm);
  color: var(--text); font-size: 13.5px; cursor: pointer; text-align: left; font-family: inherit; }
.user-pop a:hover, .user-pop button:hover { background: var(--surface-2); text-decoration: none; }
.user-pop .salir { color: var(--danger); }
.user-pop [data-lucide], .user-pop svg { width: 16px; height: 16px; }

/* ===== Chat IA flotante ===== */
.ia-widget { position: fixed; right: 22px; bottom: 22px; z-index: 80; }
.ia-burbuja { width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary); color: var(--on-primary, #fff); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center; transition: transform .15s ease; }
.ia-burbuja:hover { transform: scale(1.07); }
.ia-burbuja [data-lucide], .ia-burbuja svg { width: 24px; height: 24px; }
.ia-panel { position: absolute; right: 0; bottom: 64px; width: 360px; max-width: calc(100vw - 44px);
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.ia-panel .chat-scroll { max-height: 46vh; min-height: 180px; }
.ia-panel-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; }
@media (max-width: 760px) {
  .ia-widget { right: 14px; bottom: 14px; }
  .ia-panel { width: calc(100vw - 28px); }
  .ia-panel .chat-scroll { max-height: 55vh; }
}

/* ===== Burbuja IA: look 3D + animaciones (sigue el color de acento) ===== */
.ia-burbuja {
  background: radial-gradient(circle at 30% 25%,
              color-mix(in oklch, var(--primary) 55%, white) 0%,
              var(--primary) 45%,
              color-mix(in oklch, var(--primary) 75%, black) 100%);
  box-shadow:
    inset 0 2px 4px color-mix(in oklch, white 45%, transparent),
    inset 0 -3px 5px color-mix(in oklch, black 28%, transparent),
    0 6px 16px color-mix(in oklch, var(--primary) 45%, transparent),
    0 2px 4px oklch(0 0 0 / .2);
  animation: ia-flotar 3.2s ease-in-out infinite;
  position: relative;
}
.ia-burbuja::after { /* anillo de pulso */
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid color-mix(in oklch, var(--primary) 60%, transparent);
  animation: ia-pulso 3.2s ease-out infinite;
  pointer-events: none;
}
.ia-burbuja:hover { transform: scale(1.12) rotate(-6deg); animation-play-state: paused; }
.ia-burbuja:hover::after { animation-play-state: paused; opacity: 0; }
.ia-burbuja:active { transform: scale(.96); }
@keyframes ia-flotar {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes ia-pulso {
  0% { transform: scale(.85); opacity: .9; }
  70%, 100% { transform: scale(1.45); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ia-burbuja, .ia-burbuja::after { animation: none; }
}

/* ===== Selector de columnas ===== */
.cols-ctl { position: relative; display: flex; justify-content: flex-end; margin-bottom: 6px; }
.cols-menu { display: none; position: absolute; right: 0; top: 34px; z-index: 50; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; }
.cols-menu.open { display: block; }
.cols-menu label { display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  font-size: 13px; border-radius: var(--radius-sm); cursor: pointer; }
.cols-menu label:hover { background: var(--surface-2); }

/* ===== Panel de control con navegación lateral ===== */
.config-layout { display: flex; gap: 18px; align-items: flex-start; }
.config-nav { width: 230px; flex-shrink: 0; padding: 10px; position: sticky; top: 80px;
  display: flex; flex-direction: column; gap: 2px; }
.config-nav .cfg-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-soft); font-weight: 700; padding: 12px 10px 4px; }
.config-nav button, .config-nav a { display: flex; align-items: center; gap: 9px; width: 100%;
  text-align: left; border: none; background: none; padding: 8px 10px;
  border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text); cursor: pointer;
  font-family: inherit; text-decoration: none; }
.config-nav [data-lucide], .config-nav svg { width: 16px; height: 16px; flex-shrink: 0;
  color: var(--text-soft); }
.config-nav button.active [data-lucide], .config-nav button.active svg { color: var(--primary); }
.config-nav button:hover, .config-nav a:hover { background: var(--surface-2); }
.config-nav button.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.config-body { flex: 1; min-width: 0; }
.cfg-titulo { font-size: 16px; margin: 0 0 4px; }
.cfg-head { display: flex; align-items: center; gap: 12px; }
.cfg-head .cfg-titulo { flex: 1; }
@media (max-width: 860px) {
  .config-layout { flex-direction: column; }
  .config-nav { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; }
  .config-nav .cfg-label { width: 100%; padding-top: 6px; }
  .config-nav button, .config-nav a { width: auto; }
}

/* Menú de columnas: fila con flechas de orden */
.cols-item { display: flex; align-items: center; gap: 6px; }
.cols-item label { flex: 1; display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  font-size: 13px; border-radius: var(--radius-sm); cursor: pointer; }
.cols-item label:hover { background: var(--surface-2); }
.cols-flechas button { border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; width: 22px; height: 22px; cursor: pointer; color: var(--text-soft);
  font-size: 11px; line-height: 1; }
.cols-flechas button:hover:not(:disabled) { color: var(--primary); border-color: var(--primary); }
.cols-flechas button:disabled { opacity: .3; cursor: default; }

/* Contador de chats esperando (menú WhatsApp) */
.badge-alerta { margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }

/* Icono de mensajes en la topbar: globito rojo arriba a la derecha */
.icon-btn-mensajes { position: relative; }
.icon-btn-mensajes .badge-alerta { position: absolute; top: -6px; right: -6px; margin: 0;
  min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  padding: 0 5px; border: 2px solid var(--surface); }


/* ===== Login a dos columnas ===== */
.login-body { margin: 0; }
.login-split { display: flex; min-height: 100vh; }
.login-hero { width: 44%; max-width: 560px; padding: 40px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(150deg,
    color-mix(in oklch, var(--primary) 88%, black) 0%,
    var(--primary) 55%,
    color-mix(in oklch, var(--primary) 70%, white) 130%); }
.login-hero-top { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; }
.login-logo { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25);
  width: 42px; height: 42px; border-radius: 11px; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 800; letter-spacing: .5px; }
.login-hero-mid h2 { font-size: 30px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.5px; }
.login-hero-mid p { font-size: 16px; opacity: .9; max-width: 380px; line-height: 1.6; }
.login-hero-foot { font-size: 12px; opacity: .7; }
.login-form-side { flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 30px; background: var(--bg); }
.login-form-box { width: 100%; max-width: 380px; }
.login-form-head { margin-bottom: 22px; }
.login-form-head .login-logo { background: var(--primary); color: var(--on-primary, #fff);
  border: none; margin-bottom: 14px; }
.login-form-box { font-size: 16px; }
.login-form-head h1 { font-size: 30px; margin: 0 0 6px; color: var(--text); }
.login-form-head .muted { font-size: 15px; }
.login-form-box .field label { font-size: 15px; margin-bottom: 4px; }
.login-form-box .input { padding: 14px 15px; font-size: 16px; }
.login-form-box .btn { padding: 13px; font-size: 16px; }
.login-form-box a { font-size: 15px; }
.solo-mobile { display: none; }
@media (max-width: 820px) {
  .login-hero { display: none; }
  .solo-mobile { display: inline-flex; }
}
/* ===== Manual ===== */
.manual-layout { display: flex; gap: 18px; align-items: flex-start; }
.manual-nav { width: 220px; flex-shrink: 0; padding: 12px; position: sticky; top: 80px;
  display: flex; flex-direction: column; gap: 1px; }
.manual-nav a { padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px;
  color: var(--text-soft); text-decoration: none; }
.manual-nav a:hover { background: var(--surface-2); color: var(--text); }
.manual-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.manual-body .m-titulo { font-size: 17px; margin: 0 0 10px; color: var(--text); }
.manual-body p { line-height: 1.65; }
.manual-body section { scroll-margin-top: 76px; }
/* Diagrama del circuito */
.flujo { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.flujo-paso { flex: 1; min-width: 150px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.flujo-paso .n { width: 24px; height: 24px; border-radius: 50%; background: var(--primary);
  color: var(--on-primary, #fff); font-weight: 700; font-size: 13px; display: flex;
  align-items: center; justify-content: center; }
.flujo-paso b { font-size: 14px; } .flujo-paso small { color: var(--text-soft); font-size: 12px; line-height: 1.4; }
.flujo-paso.ganado { border-color: var(--success); }
.flujo-paso.ganado .n { background: var(--success); }
.flujo-flecha { align-self: center; color: var(--text-soft); font-size: 20px; }
@media (max-width: 820px) {
  .manual-nav { display: none; }
  .flujo-flecha { display: none; }
}


/* Modo claro estilo Finder: sidebar gris, contenido y tarjetas blancas (separadas por borde) */
:root table.grilla thead th { background: var(--surface-2); }

/* Manual: mapa del menú (íconos reales del sistema) */
.mapa-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 14px; margin: 14px 0 4px; }
.mapa-menu .mm-grupo { grid-column: 1 / -1; font-size: 11px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-soft); font-weight: 700; margin: 10px 0 2px; }
.mapa-menu .mm-item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 11px; background: var(--surface); }
.mapa-menu .mm-ic { flex-shrink: 0; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); }
.mapa-menu .mm-ic svg { width: 19px; height: 19px; }
.mapa-menu .mm-item b { display: block; font-size: 13.5px; }
.mapa-menu .mm-item small { display: block; color: var(--text-soft); font-size: 12px; line-height: 1.45; margin-top: 2px; }
.m-titulo svg { width: 18px; height: 18px; vertical-align: -3px; color: var(--primary); }

/* Manual: pasos y botones por sección */
.m-shot { display: block; width: 100%; max-width: 760px; margin: 12px 0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.m-sub { font-size: 15px; font-weight: 700; margin: 22px 0 4px; color: var(--text); }
.m-pasos { margin: 6px 0 4px; padding-left: 20px; line-height: 1.7; }
.m-pasos li { margin-bottom: 4px; }
.m-botones { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.m-boton { display: flex; gap: 11px; align-items: flex-start; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; }
.m-boton .bi { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft);
  color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.m-boton .bi svg, .m-boton .bi [data-lucide] { width: 17px; height: 17px; }
.m-boton b { color: var(--text); }


/* ===== UX tablas y buscadores ===== */
table.grilla tbody tr { transition: background .1s; }
[x-cloak] { display: none !important; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-soft); }
.agenda-h { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft);
  margin: 18px 0 8px; }
.agenda-h.agenda-vencidas { color: var(--danger, #c0392b); }
/* Calendario mensual de la agenda */
.cal { overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.cal-titulo { font-size: 16px; min-width: 170px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-dow-cell { padding: 8px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-soft); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px 7px; display: flex; flex-direction: column; gap: 3px; transition: background .12s ease; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell[data-dia]:hover { background: var(--surface-2); }   /* solo días del mes (arrastrables) */
.cal-out { background: var(--surface-2); }
.cal-out .cal-num { opacity: .4; }
.cal-num { font-size: 12px; font-weight: 600; color: var(--text-soft); align-self: flex-start; }
.cal-today { background: color-mix(in oklch, var(--primary) 7%, var(--surface)); }
.cal-today .cal-num { background: var(--primary); color: var(--on-primary, #fff); border-radius: 50%;
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal-chip { display: block; font-size: 11px; line-height: 1.3; padding: 3px 7px; border-radius: 7px;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; border-left: 3px solid var(--primary); cursor: grab; }
.cal-chip:hover { filter: brightness(.97); }
.cal-chip:active { cursor: grabbing; }
.cal-chip.dragging { opacity: .45; }
.cal-chip.venc { background: #fde8e8; color: #b42318; border-left-color: #b42318; }
.cal-chip .cal-hora { font-weight: 700; }
/* Día resaltado mientras arrastrás un recontacto encima */
.cal-cell.cal-drop { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.sync-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 720px) {
  .cal-cell { min-height: 64px; }
  .cal-chip { font-size: 10px; }
  .sync-grid { grid-template-columns: 1fr; gap: 16px; }
}
.burbuja .autor { font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.filtros .campo.grow .input[type="search"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b93a7' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M15 15l-4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px center; padding-left: 34px;
}

/* Iconos en línea (dentro de texto, badges o tablas) */
.ico-inline { display:inline-flex; align-items:center; vertical-align:middle; }
.ico-inline svg { width:15px; height:15px; }

/* ===== Buscador global (topbar) ===== */
.buscador { position: relative; display: flex; align-items: center; }
.buscador-ico { position: absolute; left: 9px; display: flex; color: var(--text-soft);
  pointer-events: none; }
.buscador-ico svg { width: 15px; height: 15px; }
.buscador input { width: 200px; height: 34px; padding: 0 30px 0 30px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 13px;
  transition: width .18s ease, border-color .15s ease, background .15s ease; }
.buscador input:focus { outline: none; width: 320px; border-color: var(--primary);
  background: var(--surface); }
.buscador-kbd { position: absolute; right: 7px; font-size: 11px; color: var(--text-soft);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px;
  background: var(--surface); pointer-events: none; }
.buscador input:focus ~ .buscador-kbd { display: none; }
.buscador-pop { position: absolute; top: calc(100% + 6px); right: 0; width: 380px;
  max-width: 86vw; max-height: 70vh; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 70; display: none; }
.buscador-pop.open { display: block; }
.buscador-grupo { font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-soft); padding: 8px 10px 4px; }
.buscador-item { display: block; padding: 7px 10px; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; color: var(--text); }
.buscador-item:hover, .buscador-item.sel { background: var(--primary-soft); }
.buscador-item b { font-size: 13px; font-weight: 600; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buscador-item small { font-size: 12px; color: var(--text-soft); display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buscador-vacio { padding: 14px 10px; color: var(--text-soft); font-size: 13px;
  text-align: center; }
@media (max-width: 720px) {
  .buscador-kbd { display: none; }
  .buscador input { width: 38px; padding-right: 8px; }
  .buscador input:focus { width: 60vw; }
  .buscador-pop { width: 84vw; }
}

/* ===== Badge de estado (color de usuario, con borde para definición) ===== */
.badge-estado { border: 1px solid color-mix(in oklch, currentColor 35%, transparent);
  font-weight: 600; }

/* ===== Paginación de listados ===== */
.paginacion { display: flex; align-items: center; gap: 12px; justify-content: center;
  margin: 16px 0 4px; flex-wrap: wrap; }
.paginacion .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.paginacion-info { font-size: 13px; color: var(--text-soft); }

/* ===== Estado vacío (sin datos) ===== */
.vacio { display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 16px; text-align: center; color: var(--text-soft); }
.vacio svg { width: 34px; height: 34px; opacity: .55; }
.vacio b { color: var(--text); font-size: 15px; }
.vacio p { margin: 0; font-size: 13px; }

/* ===== Indicador de carga HTMX ===== */
.htmx-indicator { opacity: 0; transition: opacity .15s ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.cargando-barra { position: fixed; top: 0; left: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: cargando-mov 1s linear infinite; z-index: 90; }
@keyframes cargando-mov { 0% { background-position: -40% 0; } 100% { background-position: 140% 0; } }
#cargando-global { opacity: 0; }
#cargando-global.activa { opacity: 1; }

/* ===== Campana de notificaciones ===== */
.campana { position: relative; }
.campana .icon-btn { position: relative; }
.campana-num { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.campana-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 340px;
  max-width: 88vw; max-height: 70vh; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 70; padding: 6px; }
.campana-head { font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-soft); padding: 8px 10px 6px; }
.campana-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: 13px; }
.campana-item:hover { background: var(--primary-soft); text-decoration: none; }
.campana-item .ico-inline svg { width: 16px; height: 16px; }
.campana-vacio { padding: 18px 10px; text-align: center; color: var(--text-soft); font-size: 13px; }

/* ===== Sección "Hoy" del inicio ===== */
.hoy-card { margin-bottom: 18px; border-left: 3px solid var(--primary); }
.hoy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 10px; }
.hoy-col h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .03em; }
.hoy-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hoy-lista a { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 6px 8px;
  border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: 13px; }
.hoy-lista a:hover { background: var(--primary-soft); }
.hoy-lista .badge { margin-left: auto; }

/* ============================================================
   Específico de Abogados
   ============================================================ */

/* ---------- Login (clases propias de esta app) ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-card { width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .mark { background: var(--primary); color: #fff; font-weight: 800; font-size: 18px; width: 52px; height: 52px;
  border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.login-brand h1 { font-size: 17px; margin: 0 0 2px; }
.login-brand p { color: var(--text-soft); margin: 0; font-size: 13px; }
.login-card input[type=text], .login-card input[type=email], .login-card input[type=password] {
  width: 100%; padding: 9px 11px; font-size: 14px; font-family: var(--font);
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text);
}
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- Paginación de listados ---------- */
.paginacion { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 16px 0 4px; }
.paginacion a, .paginacion .actual {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500;
}
.paginacion a:hover { background: var(--surface-2); text-decoration: none; border-color: var(--border-strong); }
.paginacion .actual { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.paginacion-info { color: var(--text-soft); font-size: 13px; margin-left: auto; }

/* Símbolo de moneda en celdas/montos */
.moneda-sim { color: var(--text-soft); font-weight: 500; margin-right: 1px; }

/* ---------- Autoguardado + UX del caso ---------- */
.autosave-status {
  position: sticky; top: 66px; z-index: 25; float: right;
  margin: -6px 0 6px; padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: var(--surface-2);
  color: var(--text-soft); border: 1px solid var(--border);
  opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.autosave-status.visible { opacity: 1; transform: translateY(0); }
.autosave-status.ok { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.autosave-status.err { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

.check-inline { display: flex; align-items: center; gap: 8px; padding-top: 24px; }

/* Estado de documentación (chips) */
.doc-estado { display: inline-flex; align-items: center; gap: 6px; }

/* Checklist de documentación en modo solo-lectura (se marca al subir, no a mano) */
.checklist-ro label { cursor: default; color: var(--text); }
.checklist-ro input[disabled] { accent-color: var(--primary); cursor: not-allowed; }
.checklist-ro label:has(input:checked) { color: var(--text); font-weight: 600; }

/* ---------- Inputs numéricos sin flechitas (spinner) ---------- */
input[type=number].input::-webkit-outer-spin-button,
input[type=number].input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number].input { -moz-appearance: textfield; appearance: textfield; }

/* ---------- Documentación: tarjetas por tipo de documento ---------- */
.docs-grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.doc-card {
  border: 1px solid var(--border); border-radius: 11px; padding: 13px; background: var(--surface);
  display: flex; flex-direction: column; gap: 11px;
}
.doc-card.is-ok { border-color: color-mix(in oklch, var(--success) 45%, var(--border)); background: color-mix(in oklch, var(--success) 5%, var(--surface)); }
.doc-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.doc-card-name { font-weight: 600; font-size: 14px; }
.doc-card-files { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 8px; }
.doc-thumb-wrap { position: relative; }
.doc-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 9px; border: 1px solid var(--border); cursor: pointer; display: block; }
.doc-thumb:hover { border-color: var(--primary); }
.doc-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; font-size: 12.5px;
}
.doc-chip a { color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.doc-chip svg { width: 15px; height: 15px; color: var(--text-soft); }
.doc-x { color: var(--danger); font-size: 11px; font-weight: 700; line-height: 1; }
.doc-thumb-wrap .doc-x {
  position: absolute; top: -7px; right: -7px; width: 19px; height: 19px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.doc-vacio { color: var(--text-soft); font-size: 12px; }
.doc-up-input { display: none; }
.doc-up-btn { width: 100%; justify-content: center; cursor: pointer; }

/* Caso: tarjetas por sección, compactas (densidad) */
.caso-form .form-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: var(--section-gap);
}
.caso-form .form-section > h2 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--primary); font-weight: 700; margin: 0 0 10px; padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   Tema global "Flux" (dashboardpack): gradient-forward, Inter,
   radio pill, glow, header frosted-glass, fondo dot-grid.
   El acento sigue siendo configurable; los gradientes derivan de él.
   ============================================================ */
:root { --radius: 14px; --radius-sm: 10px; --flux2: color-mix(in oklab, var(--primary), #3b82f6 45%); }
[data-theme="dark"] { --flux2: color-mix(in oklab, var(--primary), #3b82f6 45%); }

/* Botón primario: gradiente + sombra de color (glow) */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--flux2));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px -5px color-mix(in oklch, var(--primary) 60%, transparent);
}
.btn-primary:hover { filter: brightness(1.06); text-decoration: none; }

/* Marca y avatares con gradiente + glow */
.sidebar-brand .mark, .user-mini .avatar, .login-brand .mark {
  background: linear-gradient(135deg, var(--primary), var(--flux2));
  box-shadow: 0 5px 14px -3px color-mix(in oklch, var(--primary) 55%, transparent);
}

/* Topbar frosted-glass */
.topbar {
  background: color-mix(in oklch, var(--surface) 70%, transparent);
  backdrop-filter: blur(12px) saturate(1.6);
  -webkit-backdrop-filter: blur(12px) saturate(1.6);
}

/* Item de menú activo con leve glow del acento */
.nav-item.active { box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--primary) 22%, transparent); }

/* Números destacados del panel: texto con gradiente */
.stat .num { color: var(--text); }
.stat.accent .num {
  background: linear-gradient(135deg, var(--primary), var(--flux2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Fondo dot-grid muy sutil en el área de contenido */
.main {
  background-image: radial-gradient(color-mix(in oklch, var(--text) 5%, transparent) 1px, transparent 1px);
  background-size: 22px 22px; background-position: -1px -1px;
}

/* Tipografía Inter un poco más ajustada (estilo Flux) */
body { letter-spacing: -0.011em; }
.page-head h1, .topbar .page-title { letter-spacing: -0.02em; }

/* ---------- Hero del inicio (estilo Flux: banner con gradiente + KPIs) ---------- */
.hero-flux {
  background: linear-gradient(120deg, var(--primary), var(--flux2));
  border-radius: 18px; padding: 22px 24px; margin-bottom: 18px; color: #fff;
  box-shadow: 0 14px 36px -14px color-mix(in oklch, var(--primary) 65%, transparent);
}
.hero-flux-top { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.hero-flux h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; color: #fff; }
.hero-flux p { margin: 4px 0 0; opacity: .85; font-size: 14px; }
.hero-flux-actions { margin-left: auto; display: flex; gap: 8px; }
.hero-btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; backdrop-filter: blur(4px); }
.hero-btn:hover { background: rgba(255,255,255,.26); }
.hero-btn-primary { background: #fff; border-color: #fff; color: var(--primary); font-weight: 600; }
.hero-btn-primary:hover { background: #fff; filter: brightness(.96); text-decoration: none; }
.hero-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 20px; }
.kpi {
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px; padding: 14px 16px; color: #fff; backdrop-filter: blur(6px);
  transition: background .15s ease;
}
.kpi:hover { background: rgba(255,255,255,.22); text-decoration: none; }
.kpi-num { font-size: 26px; font-weight: 800; line-height: 1; }
.kpi-lbl { font-size: 12.5px; opacity: .85; margin-top: 6px; }

/* ---------- Buscador global en el header (estilo Flux) ---------- */
.topbar-search { flex: 1; max-width: 420px; }
.topbar-search input {
  width: 100%; height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 13.5px; font-family: var(--font);
}
.topbar-search input:focus { outline: none; border-color: var(--primary); background: var(--surface); }
@media (max-width: 720px) { .topbar-search { display: none; } }

/* ============================================================
   Detalle de caso — densidad compacta (legible: inputs ≥34px, texto ≥13px)
   ============================================================ */
/* Grilla densa: campos relacionados comparten fila */
/* Grilla FIJA y consistente: cada campo cae siempre en la misma columna,
   así Cliente y Tercero (mismo orden) alinean columna por columna. */
.caso-form .cg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--field-gap) 14px; align-items: start; }
@media (max-width: 1180px) { .caso-form .cg { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .caso-form .cg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .caso-form .cg { grid-template-columns: 1fr; } }
.caso-form .cg-full { margin-top: var(--field-gap); }
.caso-form .field { gap: 3px; min-width: 0; }
.caso-form .field > label { font-size: 13px; font-weight: 500; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caso-form .input, .caso-form select.input { height: var(--ctl-h); padding: 4px 10px; font-size: 14px; }
.caso-form textarea.input { min-height: 46px; font-size: 14px; padding: 7px 10px; }
.caso-form .helptext { font-size: 11px; }
.caso-form .hint { font-size: 12px; margin-bottom: 8px; }
.caso-form h3.sub { font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-soft); margin: 12px 0 6px; }
/* Checklist de documentación: una sola fila en desktop, baja responsivo */
.caso-form .checklist { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.caso-form .checklist label { font-size: 13px; white-space: nowrap; }
/* Tabla de vehículos compacta + botón chico */
.caso-form table.lista-mov th, .caso-form table.lista-mov td { padding: 4px 7px; font-size: 13px; }
.caso-form table.lista-mov .input { height: 32px; }
.caso-form [data-add-row] { padding: 4px 10px; font-size: 12.5px; }

/* Secciones secundarias colapsables */
.caso-form details.sec-col { }
.caso-form details.sec-col > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--primary); font-weight: 700;
}
.caso-form details.sec-col > summary::-webkit-details-marker { display: none; }
.caso-form details.sec-col > summary::after { content: "⌄"; margin-left: auto; font-size: 18px;
  line-height: 1; transition: transform .15s ease; }
.caso-form details.sec-col[open] > summary::after { transform: rotate(180deg); }
.caso-form details.sec-col[open] > summary { margin-bottom: 12px; }

/* Sección secundaria abierta: barra de acento Vuexy en el título */
.caso-form details.sec-col > summary { color: var(--primary); }

/* ============================================================
   VUEXY — lenguaje visual (tokens definitivos + componentes)
   Cambiá --primary en un solo lugar (Configuración) y repinta todo.
   ============================================================ */
:root {
  --radius: 8px; --radius-sm: 6px;
  /* Densidad global (Vuexy compacto): alto de controles y separaciones */
  --ctl-h: 36px; --field-gap: 9px; --section-gap: 13px;
  --shadow: 0 4px 18px -6px rgba(34,41,47,.12), 0 2px 6px -2px rgba(34,41,47,.05);
  --shadow-lg: 0 10px 30px -8px rgba(34,41,47,.20);
  --success: #28c76f; --success-soft: color-mix(in srgb, #28c76f 14%, #fff);
  --warning: #ff9f43; --warning-soft: color-mix(in srgb, #ff9f43 16%, #fff);
  --danger:  #ea5455; --danger-soft:  color-mix(in srgb, #ea5455 14%, #fff);
  --info:    #00cfe8; --info-soft:    color-mix(in srgb, #00cfe8 14%, #fff);
  --secondary: #82868b; --secondary-soft: color-mix(in srgb, #82868b 15%, #fff);
}
[data-theme="dark"] {
  --bg: #25293c; --surface: #2f3349; --surface-2: #393d54;
  --border: #3b4253; --border-strong: #4b5066; --text: #d0d2d6; --text-soft: #a7abbd;
  --success-soft: color-mix(in srgb, #28c76f 22%, #2f3349);
  --warning-soft: color-mix(in srgb, #ff9f43 22%, #2f3349);
  --danger-soft:  color-mix(in srgb, #ea5455 22%, #2f3349);
  --info-soft:    color-mix(in srgb, #00cfe8 22%, #2f3349);
  --secondary-soft: color-mix(in srgb, #82868b 24%, #2f3349);
}

/* Botones: sólido con sombra de color (Vuexy), sin gradiente */
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: var(--on-primary);
  box-shadow: 0 2px 6px -1px color-mix(in srgb, var(--primary) 48%, transparent);
}
.btn-primary:hover { background: var(--primary-dark); filter: none; }

/* Inputs y cards Vuexy */
.input, select.input, textarea.input { border-radius: 6px; }
.card { border-color: color-mix(in oklch, var(--border) 70%, transparent); box-shadow: var(--shadow); }

/* Badges/pills tonales (estilo Vuexy: fondo tenue + texto del color) */
.badge { background: var(--secondary-soft); color: var(--secondary); border: none; font-weight: 600; }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-alarm { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }

/* Sidebar/topbar Vuexy: limpios (sin frosted, sin dot-grid) */
.topbar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
.main { background-image: none; }

/* Marca: cuadrado sólido del primario (Vuexy) */
.sidebar-brand .mark, .user-mini .avatar, .login-brand .mark {
  background: var(--primary); box-shadow: none;
}

/* ============================================================
   VUEXY — contraste de fondo: página gris, cards blancas que flotan
   ============================================================ */
:root { --bg: #f8f7fa; }                 /* página gris muy clara */
[data-theme="dark"] { --bg: #25293c; }   /* página oscura; cards (--surface) un punto más claras */

/* El área de contenido usa el gris de página (no blanco) para que las cards se despeguen */
.main { background: var(--bg); }
/* Sidebar blanca (Vuexy) */
.sidebar { background: var(--surface); }
/* Cards/secciones del caso: blancas con sombra suave y borde tenue */
.caso-form .form-section {
  background: var(--surface);
  border-color: color-mix(in oklch, var(--border) 55%, transparent);
  box-shadow: var(--shadow);
}

/* ---------- Vehículos: botón eliminar fila ---------- */
.caso-form .borrar-celda input[type="checkbox"] { display: none; }
.veh-del { border: none; background: transparent; color: var(--danger); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 4px 7px; border-radius: 6px; }
.veh-del:hover { background: var(--danger-soft); }

/* ---------- Datos del siniestro: izquierda apilada + descripción al costado ---------- */
.caso-form .siniestro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--field-gap) 14px; align-items: stretch; }
.caso-form .sin-left { display: flex; flex-direction: column; gap: var(--field-gap); }
.caso-form .sin-right { display: flex; }
.caso-form .sin-right .field { flex: 1; }
.caso-form .sin-right textarea.input { height: 100%; min-height: 96px; }
@media (max-width: 760px) { .caso-form .siniestro-grid { grid-template-columns: 1fr; } }

/* Menú desplegable de exportación (Facturas) */
.exportar-menu { position: relative; display: inline-block; }
.exportar-menu > summary { list-style: none; cursor: pointer; }
.exportar-menu > summary::-webkit-details-marker { display: none; }
.exportar-menu .exportar-opciones {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  min-width: 230px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 6px; display: grid; gap: 2px;
}
.exportar-menu .exportar-opciones a {
  display: block; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-size: 14px;
}
.exportar-menu .exportar-opciones a:hover { background: var(--surface-2); }
.exportar-menu .exportar-sep { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }
.exportar-menu .exportar-custom { padding: 4px 10px 8px; display: grid; gap: 6px; }
.exportar-menu .exportar-titulo { margin: 2px 0 4px; font-size: 12px; color: var(--text-soft); font-weight: 600; }
.exportar-menu .exportar-custom label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.exportar-menu .exportar-custom label input[type="checkbox"] { margin: 0; }
.exportar-menu .exportar-estado { flex-direction: column; align-items: stretch; gap: 4px; margin-top: 6px; font-size: 12px; color: var(--text-soft); }
.exportar-menu .exportar-custom button { margin-top: 6px; width: 100%; }

/* Editor de texto con formato (Plantillas) */
.editor-oculto { display: none; }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 6px; border: 1px solid var(--border); border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--surface-2); }
.editor-toolbar button { min-width: 34px; height: 30px; padding: 0 8px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 6px; cursor: pointer; }
.editor-toolbar button:hover { background: var(--primary-soft); border-color: var(--primary); }
.editor-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.editor-rico { min-height: 260px; max-height: 60vh; overflow-y: auto;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); line-height: 1.6;
  text-align: left; cursor: text; }
.editor-rico:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.editor-rico p { margin: 0 0 10px; }
.editor-rico h1, .editor-rico h2, .editor-rico h3 { margin: 12px 0 8px; line-height: 1.3; }
.editor-rico ul, .editor-rico ol { margin: 0 0 10px; padding-left: 22px; }
.editor-rico:empty::before { content: "Escribí el texto acá. Usá la barra para dar formato y los chips de la derecha para insertar datos del caso."; color: var(--text-soft); }

/* Logo del estudio */
.sidebar-brand .mark { display: none; }
.sidebar-brand .brand-icono { display: none; height: 34px; width: auto;
  background: #fff; padding: 3px 5px; border-radius: 7px; }
.sidebar-brand .brand-logo { height: 40px; width: auto; max-width: 100%; object-fit: contain;
  background: #fff; padding: 5px 8px; border-radius: 8px; }
@media (min-width: 901px) {
  .app-shell.nav-mini .sidebar-brand .brand-logo { display: none; }
  .app-shell.nav-mini .sidebar-brand .brand-icono { display: block; }
}
.login-brand .brand-logo { display: block; width: 100%; max-width: 250px; height: auto;
  margin: 0 auto 12px; background: #fff; padding: 10px 14px; border-radius: 12px; }

/* Desplegable de firmas (selección múltiple) en "Generar escrito" */
.firma-menu { position: relative; display: inline-block; }
.firma-menu > summary.firma-summary { list-style: none; cursor: pointer; min-width: 280px;
  display: flex; align-items: center; justify-content: space-between; }
.firma-menu > summary.firma-summary::-webkit-details-marker { display: none; }
.firma-menu > summary.firma-summary::after { content: "⌄"; margin-left: 10px; color: var(--text-soft); }
.firma-menu[open] > summary.firma-summary::after { content: "⌃"; }
.firma-menu .firma-opciones { position: absolute; left: 0; top: calc(100% + 4px); z-index: 20;
  min-width: 300px; max-height: 300px; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 6px; display: grid; gap: 2px; }
.firma-menu .firma-opciones label { display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; }
.firma-menu .firma-opciones label:hover { background: var(--surface-2); }
.firma-menu .firma-sep { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }

/* Botón de descarga de adjuntos en Documentación */
.doc-dl { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  margin-left: 4px; border-radius: 5px; font-weight: 700; text-decoration: none;
  color: var(--primary); background: var(--primary-soft); font-size: 13px; line-height: 1; }
.doc-dl:hover { background: var(--primary); color: #fff; }

/* Mockups de pantallas para el Manual de uso */
.mk { border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; margin: 12px 0; background: var(--surface); }
.mk-top { background: var(--surface-2); color: var(--text-soft); padding: 6px 12px; font-size: 12px; border-bottom: 1px solid var(--border); }
.mk-row { display: flex; }
.mk-side { width: 150px; flex-shrink: 0; background: var(--surface-2); border-right: 1px solid var(--border); padding: 8px; font-size: 12px; }
.mk-side .grp { font-size: 10px; letter-spacing: .4px; color: var(--text-soft); margin: 8px 0 3px; }
.mk-side .it { padding: 4px 8px; border-radius: 6px; margin-bottom: 2px; color: var(--text-soft); }
.mk-side .it.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.mk-main { flex: 1; min-width: 0; padding: 12px; }
.mk-h { font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.mk-fld { border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; margin: 5px 0; font-size: 13px; color: var(--text-soft); }
.mk-btn { display: inline-block; background: var(--primary); color: var(--on-primary); padding: 5px 12px; border-radius: 7px; font-size: 12px; margin-right: 5px; }
.mk-btn.g { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.mk-tabs { display: flex; gap: 8px; border-bottom: 1.5px solid var(--border); margin-bottom: 10px; }
.mk-tabs .tb { padding: 4px 10px; font-size: 12px; color: var(--text-soft); }
.mk-tabs .tb.on { color: var(--primary); font-weight: 700; border-bottom: 2px solid var(--primary); }
.mk-det { border: 1px solid var(--border); border-radius: 7px; padding: 7px 12px; margin: 5px 0; font-size: 13px; color: var(--text); }
.mk-det::before { content: "▸ "; color: var(--text-soft); }
.mk-badge { display: inline-block; background: var(--primary); color: var(--on-primary); font-weight: 700;
  font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.mk-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.mk-card { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; flex: 1; min-width: 150px; }
.m-roles { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.m-roles th, .m-roles td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; vertical-align: top; }
.m-roles th { background: var(--primary-soft); color: var(--primary); }
.m-roles .si { color: var(--success); font-weight: 700; }
.m-roles .no { color: var(--text-soft); }
