* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--app-bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 400; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--brand-header-bg);
  color: var(--brand-primary-ink);
  padding: 12px 24px;
  border-bottom: 3px solid transparent;
  border-image: var(--brand-silver-gradient) 1;
  position: relative; z-index: 50; /* the bell and user pop-ups open above the glass cards and sticky bars below */
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 0; font-size: 1.3rem; letter-spacing: .08em; text-transform: uppercase; }
.tagline { margin: 0; opacity: .85; font-size: .85rem; }
.logo { width: 44px; height: 44px; display: block; }
.demo-badge {
  font-size: .75rem; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.4);
}

/* ---------- Sign-in (Appbogado-style glass card, TecjuridicosApp colors) ---------- */
.auth-screen {
  min-height: 100vh; display: grid; place-items: center; background: var(--auth-bg);
  padding-block: 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.auth-card {
  width: min(400px, 100%); padding: 32px 30px; border-radius: 22px; text-align: center;
  background: var(--glass); border: 1px solid var(--glass-border); color: var(--on-dark);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 10, 30, .45);
}
.auth-logo { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.auth-title { font-family: var(--font-heading); font-weight: 400; letter-spacing: .14em; text-transform: uppercase; margin: 16px 0 2px; font-size: 1.25rem; }
.auth-sub { margin: 0 0 22px; color: var(--on-dark-muted); letter-spacing: .2em; text-transform: uppercase; font-size: .72rem; }
.auth-card form { text-align: left; }
.auth-card label { color: var(--on-dark-muted); }
.auth-card input { background: rgba(255, 255, 255, .1) !important; border-color: var(--glass-border) !important; color: var(--on-dark) !important; }
.auth-card .form-error { color: #ffb4ab; }
.auth-card button.primary { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; box-shadow: 0 8px 24px rgba(2, 124, 198, .45); }
.auth-note { font-size: .85rem; color: var(--on-dark-muted); text-align: left; }
.auth-note strong { color: var(--on-dark); }
.demo-logins { margin-top: 18px; border-top: 1px solid var(--glass-border); padding-top: 6px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-grid button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: rgba(255, 255, 255, .08); border-color: var(--glass-border); color: var(--on-dark); border-radius: 10px; padding: 8px 10px;
}
.demo-grid button:hover { background: rgba(255, 255, 255, .16); }
.demo-grid button span { font-size: .72rem; color: var(--on-dark-muted); }

/* ---------- Notifications bell ---------- */
.bell { position: relative; }
.bell summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; position: relative; }
.bell summary::-webkit-details-marker { display: none; }
.bell summary:hover { background: rgba(255, 255, 255, .12); }
.bell-count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--error); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center;
}
.bell-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(360px, calc(100vw - 32px)); max-height: 70vh; overflow: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
@media (max-width: 760px) { .bell { position: static; } .bell-pop { right: 16px; } } /* on phones the box hangs from the top bar, so it stays inside the screen */
.bell-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.bell-head button { font-size: .75rem; padding: 4px 8px; }
#bell-list { list-style: none; margin: 0; padding: 0; }
#bell-list a { display: flex; gap: 10px; padding: 10px 12px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
#bell-list li.unread a { background: color-mix(in srgb, var(--brand-blue) 8%, transparent); }
#bell-list a:hover { background: var(--surface-muted); }
#bell-list small { display: block; color: var(--text-muted); font-size: .76rem; }
#bell-list .empty { padding: 14px; }
.note-ico { width: 22px; flex: none; text-align: center; color: var(--brand-blue); font-weight: 700; }

/* ---------- User menu ---------- */
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px; border-radius: 999px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: rgba(255, 255, 255, .12); }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #fff, var(--brand-silver-light)); color: var(--brand-navy); font-weight: 700; font-size: .8rem;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; font-size: .82rem; }
.user-meta span { opacity: .8; font-size: .74rem; }
.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 240px; padding: 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  display: grid; gap: 6px;
}
.user-pop p { margin: 0 0 4px; }
.user-pop button { text-align: left; }

/* ---------- Shell & navigation ---------- */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 72px); }
.sidenav {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 12px;
  background: var(--sidebar-bg);
}
.sidenav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px; color: var(--sidebar-ink); text-decoration: none; font-weight: 500;
  transition: background .15s, color .15s;
}
.sidenav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-text { display: grid; gap: 1px; min-width: 0; line-height: 1.2; }
.nav-desc { font-size: .7rem; font-weight: 400; opacity: .72; line-height: 1.25; }
.sidenav a.active {
  background: linear-gradient(90deg, var(--brand-blue), #0a63a8); color: #fff;
  box-shadow: 0 6px 16px rgba(2, 124, 198, .35);
}
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
main { padding: 20px 24px; min-width: 0; max-width: 1400px; }

.view-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.view-head h2 { margin: 0; font-size: 1.15rem; letter-spacing: .04em; color: var(--heading); }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { margin: 0; width: auto; min-width: 220px; }
.view-head .toolbar { flex-wrap: nowrap; }
.toolbar input[type=checkbox], .toolbar input[type=radio] { min-width: 0; width: auto; flex: none; }
.toolbar button { white-space: nowrap; }
#client-search { min-width: 280px; }
.hint { color: var(--text-muted); font-size: .88rem; margin: 0 0 12px; }
.muted { color: var(--text-muted); font-size: .85rem; }
.empty { color: var(--text-muted); }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
.panel-title { margin: 0 0 14px; font-size: .9rem; color: var(--heading); letter-spacing: .03em; }

/* ---------- Dashboard: command center (Appbogado layout, TecjuridicosApp colors) ---------- */
.command {
  background: var(--command-bg); color: var(--on-dark); border-radius: 20px; padding: 22px;
  box-shadow: 0 18px 40px rgba(0, 27, 66, .25); margin-bottom: 16px;
}
.command-head { margin-bottom: 14px; }
.eyebrow { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--k1); font-weight: 600; }
.command-head h2 { margin: 4px 0 0; font-size: 1.25rem; color: #fff; text-wrap: balance; }
.command .kpis { margin: 0; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.command .kpi {
  background: var(--command-tile); border: 1px solid rgba(255, 255, 255, .1); border-top: 0; box-shadow: none; color: var(--on-dark);
  gap: 4px;
}
.command .kpi:hover { background: rgba(255, 255, 255, .1); }
.command .kpi-value { color: #fff; font-size: 1.9rem; }
.command .kpi-label, .command .kpi-sub { color: var(--on-dark-muted); text-transform: none; letter-spacing: 0; font-size: .82rem; }
.command .ico { width: 22px; height: 22px; }
.k1 { color: var(--k1); } .k2 { color: var(--k2); } .k3 { color: var(--k3); } .k4 { color: var(--k4); } .k5 { color: var(--k5); }
.dash-grid.three { grid-template-columns: 1.1fr 1fr 1fr; }
.recent li.late { box-shadow: inset 3px 0 0 var(--error); }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  border-top: 3px solid var(--brand-blue); transition: transform .15s;
}
.kpi:hover { transform: translateY(-2px); }
.kpi-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-family: var(--font-heading); font-size: 2rem; color: var(--heading); line-height: 1.2; }
.kpi-sub { font-size: .8rem; color: var(--text-muted); }
.dash-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 160px) 1fr 32px; align-items: center; gap: 10px; font-size: .88rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; border-radius: 4px; background: var(--surface-muted); overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--brand-blue); border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recent li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-muted); }
.recent li div { display: flex; flex-direction: column; min-width: 0; }
.recent li div span { color: var(--text-muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent li.empty { display: block; background: none; }

/* ---------- Jurisprudencia ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border-radius: 999px; padding: 8px 16px; background: var(--surface); box-shadow: var(--shadow); }
.tabs button.active { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }
.grid4 { display: grid; grid-template-columns: 1.4fr 1.6fr 1fr 1fr; gap: 0 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; background: var(--surface-muted); color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge.bad { color: var(--error); border-color: color-mix(in srgb, var(--error) 40%, transparent); background: color-mix(in srgb, var(--error) 10%, transparent); }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.result-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.result-card h4 { margin: 6px 0 0; font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; color: var(--heading); }
.result-card p { margin: 2px 0; }
.result-card .toolbar { margin-top: auto; padding-top: 8px; }
.result-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.toolbar a, .saved-list a, .verify-item a { color: var(--link); font-size: .88rem; }
.analysis { margin-top: 14px; }
.analysis h3 { margin: 8px 0 2px; font-family: var(--font-body); font-weight: 700; color: var(--heading); }
.analysis h4 { margin: 16px 0 4px; font-size: .82rem; color: var(--heading); letter-spacing: .03em; }
.analysis p, .analysis li { font-family: var(--font-document); line-height: 1.6; }
blockquote { margin: 8px 0; padding: 8px 14px; border-left: 3px solid var(--brand-blue); background: var(--surface-muted); border-radius: 0 8px 8px 0; font-family: var(--font-document); }
blockquote cite { display: block; font-size: .8rem; color: var(--text-muted); font-style: normal; margin-top: 4px; }
.verify-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.verify-item p { margin: 6px 0; }
.saved-list { list-style: none; padding: 0; margin: 0; }
.saved-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.saved-list p { margin: 6px 0 0; font-size: .9rem; }
.panel h2 { margin: 0 0 12px; font-size: 1rem; letter-spacing: .04em; color: var(--heading); }

.split { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; align-items: start; }
.list-panel { padding: 8px; max-height: 70vh; overflow: auto; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list .empty { padding: 12px; }
.item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent;
}
.item span { color: var(--text-muted); font-size: .8rem; }
.item:hover { background: var(--surface-muted); }
.item.selected { background: var(--surface-muted); box-shadow: inset 3px 0 0 var(--brand-blue); }

.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-head h3 { margin: 0; font-size: 1.05rem; color: var(--heading); }
.detail-head h4 { margin: 18px 0 8px; font-size: .9rem; color: var(--heading); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; margin: 14px 0; }
.facts dt { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts > .fact-wide { grid-column: 1 / -1; }

.case-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px; }
.case-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.case-card .case-bar { margin-top: auto; padding-top: 8px; }
.case-card > span { color: var(--text-muted); font-size: .85rem; }
.pill {
  display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-navy); color: #fff; letter-spacing: .02em;
}
.status-tag { font-size: .75rem; color: var(--text-muted); }

/* ---------- Table ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 2px solid var(--border); padding: 8px; }
.data-table td { border-bottom: 1px solid var(--border); padding: 10px 8px; vertical-align: top; }
.row-actions { white-space: nowrap; text-align: right; }

/* ---------- Import ---------- */
.step { margin-bottom: 14px; }
.step h3 { margin: 0 0 10px; font-size: .95rem; color: var(--heading); display: flex; align-items: center; gap: 10px; }
.step-no {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-navy); color: #fff; font-family: var(--font-body); font-size: .8rem;
}
.radio-row { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 10px; }
.radio-row label { margin: 0; }
.table-scroll { overflow-x: auto; }
.map-table select { margin: 0; min-width: 220px; }
.map-table td:nth-child(2) { color: var(--text-muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#import-preview td { white-space: pre-line; font-size: .85rem; }
#import-progress { width: 100%; margin-top: 12px; accent-color: var(--brand-blue); }
#import-result { margin-top: 12px; }
#import-result ul { margin: 6px 0; padding-left: 20px; }
#import-result .errors { max-height: 220px; overflow: auto; color: var(--error); font-size: .88rem; }

/* ---------- Users, offices, reports ---------- */
.toolbar.end { justify-content: flex-end; margin-bottom: 10px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; padding-bottom: 8px; }
.check-grid label { margin: 0; }
.office-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.office-cards h4 { margin: 0; }
.matrix th { text-align: center; white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { text-align: left; min-width: 220px; }
.matrix td.center { text-align: center; }
.matrix input { width: 18px; height: 18px; accent-color: var(--brand-blue); }
tr.inactive td { opacity: .55; }
.toggle { margin: 0; white-space: nowrap; }
.report-out { margin-top: 14px; }
#report-table td { font-variant-numeric: tabular-nums; }
button.danger-solid { background: var(--error); border-color: var(--error); color: #fff; }
#ask-dialog p { margin: 0 0 12px; }
#ask-dialog input { margin-bottom: 12px; }

/* ---------- Type-ahead ---------- */
.combo-wrap { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 40; margin: 2px 0 0; padding: 4px; list-style: none;
  max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  color: var(--text); font-weight: 400;
}
.combo-list li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; }
.combo-list li small { color: var(--text-muted); font-size: .76rem; }
.combo-list li.active, .combo-list li:hover { background: color-mix(in srgb, var(--brand-blue) 14%, transparent); }
.combo-list .combo-empty { color: var(--text-muted); cursor: default; }
.auth-card .combo-list { color: var(--text); }

/* ---------- Agenda ---------- */
.agenda { display: grid; gap: 14px; }
.agenda-day h3 { margin: 0 0 8px; font-family: var(--font-body); font-weight: 700; font-size: .9rem; color: var(--heading); }
.agenda-day.overdue h3 { color: var(--error); }
.agenda-day ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.agenda-item {
  display: grid; grid-template-columns: 70px auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.agenda-item { content-visibility: auto; contain-intrinsic-size: auto 92px; } /* v2.3.15: lo que no se ve no se calcula: la Agenda abre unas 2.5 veces más rápido */
.agenda-item:has(.btn-group[open]) { content-visibility: visible; position: relative; z-index: 20; } /* v2.3.24: content-visibility recorta lo que sobresale; el menú «Acciones» abierto no puede quedar cortado */
.agenda-item.kind-audiencia { border-left: 4px solid var(--brand-blue); }
.agenda-item.kind-termino { border-left: 4px solid var(--warn); }
.agenda-item.done { opacity: .6; }
.agenda-item .time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--heading); }
.agenda-body { display: flex; flex-direction: column; min-width: 0; }
.agenda-body .muted { font-size: .82rem; }
.overdue .agenda-item .time { color: var(--error); font-size: .8rem; }

/* ---------- Consulta de procesos ---------- */
.consulta-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
#consulta-table { min-width: 760px; }
#consulta-table td:nth-child(2) { min-width: 210px; }
/* 2.3.123: the row opens its case (click or Enter); buttons and boxes inside keep their own action. */
#consulta-table tr.case-row { cursor: pointer; transition: background-color .15s; }
#consulta-table tr.case-row:hover, #consulta-table tr.case-row:focus-visible { background-color: var(--select-tint); }
#consulta-table tr.case-row:not(.has-new):hover, #consulta-table tr.case-row:not(.has-new):focus-visible { box-shadow: inset 3px 0 0 var(--select-ring); }
#consulta-table tr.case-row:focus-visible { outline: 2px solid var(--select-ring); outline-offset: -2px; }
#consulta-table tr.case-row .copyable, #consulta-table tr.case-row .recheck-out { cursor: text; }
.min0 { min-width: 0; }
.mono { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; letter-spacing: .02em; }
.copyable { user-select: all; }
.switch { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .82rem; color: var(--text); }
.switch input { width: 18px; height: 18px; accent-color: var(--brand-blue); }
#prefs-form fieldset { display: grid; gap: 4px; }
#prefs-form input[type=email], #prefs-form input[inputmode] { margin: 0 0 6px 26px; width: calc(100% - 26px); }
.panel-title.spaced { margin-top: 18px; }
.report-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .85rem; }
.report-log li { border-bottom: 1px solid var(--border); padding-bottom: 8px; display: grid; gap: 4px; }
.report-log pre { white-space: pre-wrap; font-size: .76rem; background: var(--surface-muted); padding: 8px; border-radius: 6px; max-height: 240px; overflow: auto; }
.wide-dialog { width: min(980px, calc(100vw - 32px)); }
.nowrap { white-space: nowrap; }
.court-line { font-size: .8rem; color: var(--text-muted); }
.court-fields { background: color-mix(in srgb, var(--brand-blue) 5%, transparent); }
#court-email { margin: 0 0 8px; }
/* Version 2.27: judge of the court, suggested or typed. */
.judge-box { margin: 0 0 10px; }
.judge-options { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.judge-options li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--brand-blue) 7%, transparent); }
.judge-options li > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.judge-suggest .hint { margin: 4px 0; }

/* ---------- Despachos, roles, misc ---------- */
.file-btn {
  display: inline-flex; align-items: center; cursor: pointer; margin: 0; padding: 7px 12px; border-radius: 6px;
  background: var(--brand-primary); color: var(--brand-primary-ink); font-size: .85rem; font-weight: 500;
}
button.mini { padding: 2px 8px; font-size: .74rem; }
.role-actions { display: flex; gap: 4px; justify-content: center; margin-top: 4px; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; padding: 6px 0 8px; }
.perm-grid label { margin: 0; font-size: .84rem; }
.perm-grid input:disabled + * { opacity: .7; }

/* ---------- Documents: templates ---------- */
.tpl-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.tpl-lib { position: sticky; top: 12px; max-height: calc(100vh - 140px); overflow: auto; display: grid; gap: 10px; }
.tpl-lib input[type=search] { margin: 0; }
.tpl-lib h4 { margin: 8px 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-family: var(--font-body); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 999px; padding: 4px 10px; font-size: .78rem; background: var(--surface-muted); }
.chip.active { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }
.tpl-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tpl-items li { position: relative; }
.tpl-item {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent;
}
.tpl-item span { font-size: .76rem; color: var(--text-muted); }
.tpl-item:hover { background: var(--surface-muted); }
.tpl-item.selected { background: color-mix(in srgb, var(--brand-blue) 10%, transparent); border-color: color-mix(in srgb, var(--brand-blue) 35%, transparent); }
.tpl-tools { display: flex; gap: 4px; justify-content: flex-end; padding: 0 6px 6px; }
.tpl-work h3 { margin: 6px 0 0; font-family: var(--font-body); font-weight: 700; font-size: 1.1rem; color: var(--heading); }
.tpl-work #tpl-empty h3 { font-family: var(--font-heading); font-weight: 400; }
.tpl-work label { margin-top: 10px; }
#tpl-vars-box { margin: 8px 0 12px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
#tpl-vars-box summary { cursor: pointer; font-weight: 600; }
#tpl-vars input.missing { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface-muted)); }
#tpl-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; margin-bottom: 12px; }
.tpl-edit-row label { margin: 0 0 8px; }
.tpl-editor { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; }
.tpl-editor textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84rem; }
.var-picker { max-height: 430px; overflow: auto; border-left: 1px solid var(--border); padding-left: 12px; }
.var-picker h5 { margin: 10px 0 4px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.var-picker .chip { margin: 0 4px 4px 0; }
.base-note { background: color-mix(in srgb, var(--brand-blue) 8%, transparent); padding: 8px 10px; border-radius: 8px; }

/* ---------- Signatures and traced e-mail ---------- */
.signer-row { display: grid; grid-template-columns: 2fr 1fr 2fr 1.2fr 1.4fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.signer-row input, .signer-row select { margin: 0; min-width: 0; }
.signer-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.signer-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.signer-list li > div:last-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sig-img { height: 46px; background: #fff; border-radius: 6px; border: 1px solid var(--border); }
.sig-canvas { width: 100%; height: 180px; border: 1px dashed var(--border); border-radius: 10px; background: #fff; display: block; margin-top: 6px; }

/* ---------- Catalog ordering ---------- */
.type-row { display: grid !important; grid-template-columns: 20px 1fr auto auto; align-items: center; gap: 8px; }
.type-row.child { padding-left: 28px; }
.type-row.child .type-name::before { content: "› "; color: var(--brand-blue); }
.type-row.dragging { opacity: .45; }
.drag { cursor: grab; color: var(--text-muted); user-select: none; letter-spacing: -2px; }
.uses { font-size: .74rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.config-list li.kids { display: block; padding: 0; border-bottom: 0; }
.config-list li.kids .config-list { margin: 0; }
.order-btns { display: inline-flex; gap: 2px; }
.cat summary .order-btns { margin-left: 8px; }

/* ---------- Catalog ---------- */
.catalog { display: grid; gap: 10px; }
.cat { padding: 0; }
.cat summary { display: flex; justify-content: space-between; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; }
.cat summary::-webkit-details-marker { display: none; }
.cat summary::before { content: "▸"; color: var(--brand-blue); margin-right: 8px; }
.cat[open] summary::before { content: "▾"; }
.cat-name { font-weight: 600; flex: 1; }
.cat-body { padding: 0 18px 18px; }
.cat-body h4 { margin: 16px 0 6px; font-size: .85rem; color: var(--heading); }
.config-list { list-style: none; padding: 0; margin: 0 0 8px; }
.config-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.field-form { display: grid; grid-template-columns: 2fr 1fr 2fr auto auto; gap: 6px; align-items: center; }
.field-form input, .field-form select { margin: 0; }
.field-form label { margin: 0; }

/* ---------- Forms ---------- */
form label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 12px; color: var(--text-muted); }
form label.inline { display: flex; gap: 8px; align-items: center; color: var(--text); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 2px; margin: 0 0 14px; }
legend { font-weight: 600; font-size: .85rem; padding: 0 6px; }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  display: block; width: 100%; margin-top: 4px;
  padding: 8px 10px; font: inherit; font-size: .95rem;
  color: var(--text); background: var(--surface-muted);
  border: 1px solid var(--border); border-radius: 6px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-blue); outline-offset: 1px; }
textarea:disabled, select:disabled { opacity: .55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid2 .span2 { grid-column: 1 / -1; }
.doc-types { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-bottom: 10px; }
.doc-types label { display: flex; gap: 6px; align-items: center; margin: 0; color: var(--text); }
.form-error { color: var(--error); font-size: .88rem; }

button {
  font: inherit; cursor: pointer; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-muted); color: var(--text);
  padding: 6px 12px; font-size: .85rem;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--brand-primary); color: var(--brand-primary-ink); border-color: var(--brand-primary); }
button.primary:hover:not(:disabled) { background: var(--brand-blue); border-color: var(--brand-blue); }
button.danger { color: var(--error); }
button.wide { width: 100%; padding: 12px; font-size: 1rem; font-weight: 600; }

/* ---------- Dialogs & toast ---------- */
dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); padding: 20px;
}
dialog::backdrop { background: rgba(0, 20, 50, .45); }
dialog h3 { margin: 0 0 14px; color: var(--heading); font-size: 1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--brand-navy); color: #fff; padding: 10px 18px; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 35; /* 2.3.106: above the chat dock (30-31), which hid every message at the foot of the screen */ max-width: calc(100vw - 32px);
}
.toast.error { background: var(--error); }

/* ---------- Draft generator ---------- */
.layout { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 20px; }
.output-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.status { padding: 8px 12px; border-radius: 6px; background: var(--surface-muted); margin: 10px 0; font-size: .9rem; }
.status.error { color: var(--error); }
/* 2.3.46: the progress/result bar of Consulta de procesos stays fixed at the top of the window while the user scrolls or interacts */
#consulta-status { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 8; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-weight: 600; }
#consulta-status.error { border-color: var(--error); }
/* Version 2.13: test-link notice that sends a case-law search to the server app. */
.server-note { border-left: 4px solid var(--brand-blue, #027cc6); margin: 12px 0; }
.server-note p { margin: 0 0 10px; line-height: 1.5; }
.server-note a.button { display: inline-block; text-decoration: none; }
.audit { margin: 10px 0; font-size: .88rem; }
.audit ul { margin: 6px 0 0; padding-left: 20px; }
.audit .ok { color: var(--ok); font-weight: 600; }
.audit .error { color: var(--error); }
.audit .warning { color: var(--warn); }
.document {
  font-family: var(--font-document); font-size: 1rem; line-height: 1.65;
  border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; overflow-wrap: anywhere;
}
.document h1, .document h2, .document h3 { font-family: var(--font-document); font-weight: 700; color: var(--heading); }
.document a { color: var(--link); }
.document .empty { font-family: var(--font-body); }
.document pre.streaming { white-space: pre-wrap; font-family: var(--font-document); }
.document table { border-collapse: collapse; width: 100%; }
.document th, .document td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
mark.fill { background: var(--fill-highlight); color: inherit; padding: 0 3px; border-radius: 3px; font-weight: 700; }
details#payload-box { margin-top: 16px; }
details pre { background: var(--surface-muted); padding: 12px; border-radius: 6px; overflow: auto; font-size: .8rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash-grid.three { grid-template-columns: 1fr 1fr; }
  .tpl-layout { grid-template-columns: 1fr; }
  .tpl-lib { position: static; max-height: none; }
}
@media (max-width: 1440px) { .consulta-grid { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .layout, .split, .dash-grid, .dash-grid.three { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .field-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidenav {
    flex-direction: row; overflow-x: auto; padding: 8px 12px; gap: 4px;
    position: sticky; top: 0; z-index: 5;
  }
  .sidenav a { white-space: nowrap; padding: 8px 12px; gap: 8px; }
  .nav-desc { display: none; }
  .ico { width: 18px; height: 18px; }
  main { padding: 16px; }
  .grid2, .grid4, .field-form { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 100px 1fr 28px; }
  .agenda-item { grid-template-columns: auto 1fr; }
  .agenda-item .toolbar { grid-column: 1 / -1; }
  .perm-grid { grid-template-columns: 1fr; }
  .tpl-editor { grid-template-columns: 1fr; }
  .signer-row { grid-template-columns: 1fr 1fr; }
  .var-picker { border-left: 0; padding-left: 0; max-height: 200px; }
  .type-row { grid-template-columns: 20px 1fr; }
  .type-row .uses { display: none; }
  .type-row .toolbar { grid-column: 1 / -1; }
  .command { padding: 16px; }
  .toolbar input, .toolbar select, #client-search { min-width: 0; flex: 1; }
  .view-head .toolbar { flex-wrap: wrap; width: 100%; }
  .topbar { padding: 12px 16px; }
  .user-meta { display: none; }
  .demo-grid { grid-template-columns: 1fr; }
  .data-table thead { display: none; }
  .data-table tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .data-table td { display: block; border: 0; padding: 2px 0; }
  .row-actions { text-align: left; padding-top: 6px !important; }
}

@media print {
  .topbar, .sidenav, #draft-form, .output-head, .status, .audit, details, .toast { display: none !important; }
  .shell, .layout { display: block; }
  body, .panel, .document { background: #fff; color: #000; border: 0; }
  main { padding: 0; }
  mark.fill { background: #ffe680; }
}

/* ---------- Pagos y cartera ---------- */
a.button {
  display: inline-flex; align-items: center; font: inherit; font-size: .85rem; text-decoration: none; cursor: pointer;
  border-radius: 6px; border: 1px solid var(--border); background: var(--surface-muted); color: var(--text); padding: 6px 12px;
}
.pay-kpis .kpi-value { font-size: 1.45rem; }
.pay-kpis .kpi:hover { transform: none; }
#pay-aging .hbar { grid-template-columns: minmax(110px, 140px) 1fr minmax(96px, auto); }
#pay-aging .hbar-fill.late { background: var(--warning, #b7791f); }
#pay-aging .hbar-fill.bad { background: var(--error); }
.pay-filter { margin: 4px 0 10px; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-state { display: inline-block; font-size: .74rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-muted); white-space: nowrap; }
.pay-state.vencido { background: color-mix(in srgb, var(--error) 14%, transparent); color: var(--error); }
.pay-state.pagado { background: color-mix(in srgb, var(--success, #2f855a) 16%, transparent); color: var(--success, #2f855a); }
.pay-state.parcial { background: color-mix(in srgb, var(--brand-blue) 14%, transparent); color: var(--brand-blue); }
.pay-state.anulado { text-decoration: line-through; color: var(--text-muted); }
tr.voided td { color: var(--text-muted); }
tr.voided td:not(:last-child) { text-decoration: line-through; }

/* ---------- Microsoft sign-in ---------- */
.ms-login { display: grid; gap: 10px; margin-top: 6px; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: .8rem; margin: 4px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.ms-button { justify-content: center; gap: 10px; padding: 11px 12px; font-size: .95rem; font-weight: 600; background: var(--surface); }
.ms-button:hover { border-color: var(--brand-blue); }

/* ---------- Version (numbered change) ---------- */
.app-version { margin: 6px 0 0; font-size: .72rem; letter-spacing: .04em; color: var(--text-muted); text-align: center; }
.auth-card .app-version { color: rgba(255, 255, 255, .6); }
.auth-card .app-version { margin: -14px 0 18px; }

/* ---------- Client: natural person / legal entity ---------- */
fieldset.person-type { display: flex; flex-wrap: wrap; gap: 6px 18px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 10px; margin: 0 0 10px; }
fieldset.person-type legend { font-size: .8rem; color: var(--text-muted); padding: 0 4px; }
.span2 { grid-column: 1 / -1; }
.hint.span2 { margin: -4px 0 4px; }

/* In-app help: "?" per module and a writing tip under the focused field */
.help-btn {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin: 0 0 0 8px; padding: 0;
  border-radius: 50%; border: 1.5px solid var(--brand-blue); background: transparent; color: var(--brand-blue);
  font: 700 .8rem/1 var(--font-body, inherit); letter-spacing: 0; vertical-align: middle; cursor: pointer;
}
.help-btn:hover, .help-btn:focus-visible { background: var(--brand-blue); color: #fff; }
.command-head .help-btn { border-color: #fff; color: #fff; margin: 6px 0 0; }
.command-head .help-btn:hover { background: #fff; color: var(--brand-navy); }
.help-dialog { max-width: 560px; }
.help-dialog h4 { margin: 14px 0 6px; font-size: .95rem; }
.help-dialog ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.field-tip { display: block; margin-top: 4px; color: var(--text-muted); font-size: .8rem; font-weight: 400; line-height: 1.35; }

/* Folder number of a case (change 21) */
.folder-tag {
  display: inline-block; padding: 1px 8px; border-radius: 6px; border: 1.5px solid var(--brand-blue); color: var(--brand-blue);
  font-size: .78rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}

/* Suggestions under the fields look like the example inside them (change 22):
   the same muted gray with some transparency, so they read as a hint, not as data. */
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: .6; }
.field-tip, form .hint.span2 { color: var(--text-muted); opacity: .6; font-weight: 400; }

/* Only Gerencia deletes (change 24): delete buttons are hidden for every other role. */
body:not(.is-gerencia) [data-action^="delete-"], body:not(.is-gerencia) [data-jact^="delete-"] { display: none !important; }
body:not(.is-gerencia) [data-gerencia-only] { display: none !important; }

/* Official portals dialog */
.portal-rad { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.portal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.portal-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border, #c4c8cb); border-radius: 8px; }
.portal-item .muted { font-size: .85rem; }
.portal-item a.button { flex-shrink: 0; }

/* Word forms (minutas) and case-list filters */
.blanks-table td { vertical-align: top; }
.blank-ctx { font-size: .88rem; max-width: 520px; }
.blank-ctx mark { background: #fff3a3; color: #1a1a1a; padding: 0 2px; border-radius: 3px; font-weight: 600; }
.blanks-table select { min-width: 220px; }
.case-filters { margin-bottom: 12px; }
.case-filters .grid4 { align-items: end; }
#case-count { margin: 0 0 10px; }
/* Case rows carry several actions: let them wrap inside the cell instead of overflowing the panel. */
#case-rows .row-actions { white-space: normal; min-width: 180px; }
#case-rows .row-actions button { margin: 2px 0; }
.fees-box { margin: 10px 0; }
.fees-box .grid4 { align-items: end; }
/* Contract fee checklist (version 2.66). */
.fee-kind { grid-column: 1 / -1; margin: 0 0 10px; padding: 10px 14px; border: 1px solid var(--border, #c4c8cb); border-radius: 12px; }
.fee-kind legend { font-weight: 600; padding: 0 6px; }
.fee-kind .fee-choices { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 8px; }
.fee-kind label[hidden] { display: none; }
.fee-kind label:not(.inline) { display: block; margin-bottom: 10px; }
.fee-kind label:not(.inline) .muted { display: block; margin-top: 2px; }

/* Display preferences (change 37): badge with the layout in use, forced mobile layout on wide screens. */
.view-badge {
  font-size: .75rem; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.4); color: #fff;
}
.view-badge:hover, .view-badge:focus-visible { background: rgba(255,255,255,.22); }
html[data-view="mobile"] body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 0 1px var(--border), 0 8px 40px rgba(0,0,0,.25); min-height: 100vh; }
.auth-links { margin: 10px 0 0; text-align: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link, var(--brand-blue)); text-decoration: underline; cursor: pointer; font: inherit; }
.auth-card .form-error.ok { color: #b8f5c8; }
.verdict-badge { display: block; padding: 10px 12px; font-size: .9rem; white-space: normal; }
.channel-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.pw-row { display: flex; gap: 6px; align-items: center; } .pw-row input { flex: 1; margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* Client and case screens (fichas) */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; color: var(--text-muted); margin-bottom: 8px; }
.crumbs a { color: var(--link); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.ficha-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip-stat { display: flex; flex-direction: column; gap: 2px; font-size: .78rem; color: var(--text-muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; background: var(--surface-muted); border: 1px solid var(--border); min-width: 110px; }
.chip-stat small { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.chip-stat strong { font-size: 1rem; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
a.chip-stat:hover, button.chip-stat:hover { border-color: var(--brand-blue); }
button.chip-stat { font: inherit; font-size: .78rem; text-align: left; cursor: pointer; box-shadow: none; align-items: flex-start; }
/* Funcionario responsable panel on the case screen. */
.resp-now { margin: 0 0 10px; }
.resp-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.resp-pick label { flex: 1 1 260px; max-width: 420px; }
.resp-pick select { width: 100%; }
a.chip-stat strong { color: var(--link); }
.chip-stat.warn strong { color: var(--warn); }
.ficha-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.ficha-grid > * { min-width: 0; }
.ficha-wide { grid-column: 1 / -1; }
.ficha-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; overflow-x: auto; }
.ficha-panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.ficha-panel-head h3 { margin: 0; font-size: 1rem; }
.ficha-panel .count { font-family: var(--font-body); font-size: .72rem; font-weight: 600; color: var(--text-muted); background: var(--surface-muted); border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: middle; }
.ficha-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ficha-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.ficha-list li:last-child { border-bottom: 0; }
.ficha-sub { font-size: .82rem; color: var(--text-muted); }
.case-open-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.case-open { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.case-open:hover, .case-open:focus-visible { border-color: var(--brand-blue); box-shadow: var(--shadow); }
.case-open-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.case-open-go { justify-self: end; color: var(--brand-blue); font-size: .82rem; font-weight: 600; }
.data-table.compact td, .data-table.compact th { padding: 5px 6px; }
/* Version 2.3.48: client sheet as one board (John's choice «D»). */
.ficha-d { display: grid; grid-template-columns: minmax(250px, 290px) 1fr; gap: 16px; align-items: start; }
.ficha-d > *, .ficha-main > * { min-width: 0; }
.ficha-main { display: grid; gap: 16px; }
.ficha-id .toolbar { margin-top: 12px; }
.attn { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 12px; margin-top: 8px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--warn) 8%, transparent); }
.consent-fold > summary { cursor: pointer; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); font-weight: 600; }
.consent-fold[open] > summary { margin-bottom: 8px; }
.attn-btn { border-style: dashed; color: var(--warn); }
.folder-act { white-space: nowrap; }
.folder-act .btn-group { display: inline-block; margin-left: 6px; }
.folder-act .btn-group-pop { left: auto; right: 0; }
@media (max-width: 860px) { .ficha-d { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .ficha-grid { grid-template-columns: 1fr; } .chip-stat { min-width: 0; flex: 1 1 40%; } }

/* Change 47: back/forward, follow-up, case history */
.history-nav { display: inline-flex; gap: 4px; }
.history-nav button { font-size: .78rem; padding: 4px 10px; border-radius: 999px; cursor: pointer; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.4); color: #fff; }
.history-nav button:hover, .history-nav button:focus-visible { background: rgba(255,255,255,.24); }
.follow { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--surface-muted); color: var(--text-muted); }
.follow.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.follow.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.follow.bad { background: color-mix(in srgb, var(--error) 14%, transparent); color: var(--error); }
.follow-people { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.person-tally { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: .85rem; }
.ficha-panel tr.is-done td { opacity: .72; }
.acts-scroll { max-height: 440px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.acts-scroll thead th { position: sticky; top: 0; background: var(--surface); }
.hist-filters { margin-bottom: 10px; }
.hist-filters .chip { border: 1px solid var(--border); cursor: pointer; font: inherit; font-size: .78rem; color: var(--text); }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-height: 560px; overflow: auto; }
.history li { display: grid; grid-template-columns: 9.5rem 14px 1fr; gap: 10px; align-items: start; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.history li > div { min-width: 0; overflow-wrap: normal; word-break: normal; }
.history .h-when { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.history .h-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; background: var(--brand-silver); }
.history .h-actuacion { background: var(--brand-blue); }
.history .h-tarea { background: var(--warn); }
.history .h-pago { background: var(--ok); }
.history .h-firma, .history .h-correo { background: var(--brand-navy); }
#case-rows tr.row-link { cursor: pointer; }
#case-rows tr.row-link:hover td { background: var(--surface-muted); }
.follow-panel { margin-bottom: 14px; }
.follow-panel summary { cursor: pointer; }
.response-box { border: 1px dashed var(--border); border-radius: 10px; padding: 10px; }
@media (max-width: 760px) {
  .history li { grid-template-columns: 1fr; gap: 2px; }
  .history .h-dot { display: none; }
  .history-nav button { padding: 4px 8px; }
}
.hist-filters .chip.active { color: #fff; }
.history-nav button { white-space: nowrap; }
.agenda-body a { color: var(--link); text-decoration: none; }
.agenda-body a:hover { text-decoration: underline; }
@media (max-width: 760px) { .hn-text { display: none; } .history-nav button { font-size: 1rem; line-height: 1; padding: 5px 11px; } }
.term-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.term-box legend { font-weight: 600; padding: 0 4px; }
.term-result { margin: 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--brand-blue) 9%, transparent); font-size: .9rem; }
.term-result:empty { display: none; }

/* Change 49: parties, "Ver …" buttons, section bar */
.sec-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); padding: 6px 0; }
.case-open-list > li.case-open:hover { border-color: var(--border); box-shadow: none; }
.case-open-actions { margin-top: 6px; flex-wrap: wrap; gap: 4px; }
.ver-group { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; width: 100%; }
.parties-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.parties-grid, .parties-view { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.parties-grid > *, .parties-view > * { min-width: 0; }
.party-side h4, .parties-view h4 { margin: 4px 0 6px; font-size: .9rem; }
.party-rows { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; }
.party-row { display: grid; grid-template-columns: minmax(8.5rem, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: 8px; }
.party-row [data-p=name] { grid-column: 1 / 3; }
.party-row [data-p=role] { grid-column: 1 / 2; }
.party-row [data-p=id_number] { grid-column: 2 / 4; }
.party-row > label.inline { grid-column: 1 / -1; }
.party-row select { min-width: 0; }
/* Version 2.15: role of each party and of our main client */
.our-client-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 2px 0 8px; font-weight: 600; }
.our-client-line select { flex: 1 1 220px; max-width: 360px; }
.our-client-line select.needs-choice { outline: 2px solid var(--warn, #c77700); outline-offset: 1px; }
.role-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: .78rem; background: color-mix(in srgb, var(--accent, #027cc6) 12%, transparent); color: var(--accent, #027cc6); }
.party-row.main { grid-template-columns: 1fr auto; padding: 6px 8px; background: var(--surface-muted); border-radius: 8px; }
.party-row input { min-width: 0; }
@media (max-width: 760px) { .sec-nav { position: static; } }

/* Change 50: audit log */
.audit-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 12px; margin-bottom: 12px; }
.audit-filters .audit-q { grid-column: span 2; }
.audit-table td { vertical-align: top; }
.audit-table .nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-changes { margin: 0; padding-left: 16px; font-size: .85rem; }
.audit-changes .before { color: var(--error); text-decoration: line-through; text-decoration-thickness: 1px; }
.audit-changes .after { color: var(--ok); }
tr.audit-denied td { background: color-mix(in srgb, var(--error) 6%, transparent); }
.history .h-cambio { background: var(--brand-silver); outline: 2px solid var(--brand-navy); }
@media (max-width: 760px) { .audit-filters .audit-q { grid-column: auto; } }

/* Change 52: client menu and side-menu descriptions */
.client-link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-align: left; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.client-link:hover, .client-link:focus-visible { text-decoration-style: solid; }
.chip-stat .client-link { font-weight: 700; }
.client-menu { position: fixed; z-index: 60; width: min(420px, calc(100vw - 20px)); max-height: min(70vh, 560px); overflow: auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 20, 60, .28); padding: 12px 14px; display: grid; gap: 8px; }
.client-menu.sheet { left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-height: 75vh; border-radius: 16px 16px 0 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.client-menu p { margin: 0; }
.client-menu h4 { margin: 4px 0 0; font-size: .9rem; }
.cm-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.cm-close { background: none; border: 0; font-size: 1rem; cursor: pointer; color: var(--text-muted); }
.cm-cases { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cm-cases li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.cm-cases li:last-child { border-bottom: 0; }
.cm-cases li > span { min-width: 0; overflow-wrap: normal; word-break: normal; }
/* Change 55: one consult for every platform */
.portal-check { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-muted); }
.portal-check ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.portal-check li { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; }
.portal-check li > span:nth-child(2) { min-width: 0; }
@media (max-width: 760px) { .portal-check li { grid-template-columns: 1fr; } }
/* Change 56: legal documents and client authorizations */
.legal-doc { line-height: 1.6; overflow-wrap: anywhere; }
.legal-doc h3 { margin: 18px 0 6px; font-size: 1rem; color: var(--heading); }
.legal-doc ul, .legal-doc ol { padding-left: 22px; }
.legal-doc li { margin: 3px 0; }
.legal-meta { color: var(--text-muted); font-size: .85rem; margin: 0 0 8px; }
.legal-fill { background: #fff4d6; color: #6b4b00; padding: 0 3px; border-radius: 3px; font-weight: 600; }
.legal-table-wrap, .legal-doc table { display: block; overflow-x: auto; }
.legal-table { border-collapse: collapse; width: 100%; font-size: .88rem; margin: 6px 0 12px; }
.legal-table th, .legal-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.legal-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.legal-tabs button, .legal-tabs a { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .85rem; cursor: pointer; text-decoration: none; }
.legal-tabs .active { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
.legal-dialog { width: min(860px, calc(100vw - 24px)); }
.legal-dialog .legal-doc { max-height: 62vh; overflow: auto; padding-right: 6px; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin-top: 14px; font-size: .78rem; }
.legal-links a, .legal-links button { color: inherit; opacity: .85; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.nav-legal { display: block; margin: 4px 14px 0; font-size: .78rem; color: inherit; opacity: .8; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-align: left; }
.public-footer { max-width: 860px; margin: 0 auto; padding: 0 16px 28px; }
.consent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.consent-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.consent-card label.consent-check { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-weight: 400; color: var(--text); }
.consent-card input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; }
.consent-card h4 { margin: 0 0 6px; font-size: .95rem; }
.consent-card details { margin-top: 8px; }
.consent-card details .legal-doc { max-height: 40vh; overflow: auto; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; font-size: .9rem; }
.consent-state { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.consent-state.yes { background: #e3f6e8; color: #0d5a26; }
.consent-state.no { background: #fde2e1; color: #8a1c17; }
.consent-state.none { background: var(--surface-muted); color: var(--text-muted); }
.consent-status { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.consent-status li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.consent-status li small { grid-column: 1 / -1; color: var(--text-muted); }
.consent-history { font-size: .82rem; }
@media (max-width: 760px) { .consent-status li { grid-template-columns: 1fr; } }
@media print { .topbar, .legal-tabs, .no-print { display: none !important; } .legal-doc { max-height: none !important; overflow: visible !important; } }

/* ---------- Change 58: button styles chosen by the firm (UI UX Pro Max catalog) ----------
   Style 2 "Neumorfismo" for every button on light surfaces: soft raised buttons that sink when pressed.
   Style 3 "Glassmorphism" for buttons on the dark brand areas: sign-in, top bar, command center and side menu.
   Kept from the UI UX Pro Max checklist: visible keyboard focus, real disabled state, 150 ms feedback
   on transform/shadow only, and prefers-reduced-motion. */
:root {
  --neu-base: #e8ecf2;
  --neu-ink: var(--brand-navy);
  --neu-edge: rgba(0, 43, 106, .10);
  --neu-dark: rgba(140, 156, 184, .55);
  --neu-light: rgba(255, 255, 255, .95);
  --neu-raise: 4px 4px 10px var(--neu-dark), -4px -4px 10px var(--neu-light);
  --neu-raise-sm: 2px 2px 5px var(--neu-dark), -2px -2px 5px var(--neu-light);
  --neu-press: inset 3px 3px 7px var(--neu-dark), inset -3px -3px 7px var(--neu-light);
  --glass-btn: rgba(255, 255, 255, .14);
  --glass-btn-hover: rgba(255, 255, 255, .22);
  --glass-ring: inset 0 0 0 1px rgba(255, 255, 255, .35);
  --glass-drop: 0 8px 24px rgba(0, 10, 30, .25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --neu-base: #1b1e24; --neu-ink: #e9eaec; --neu-edge: rgba(255, 255, 255, .07);
    --neu-dark: rgba(0, 0, 0, .65); --neu-light: rgba(255, 255, 255, .05);
  }
}
:root[data-theme="dark"] {
  --neu-base: #1b1e24; --neu-ink: #e9eaec; --neu-edge: rgba(255, 255, 255, .07);
  --neu-dark: rgba(0, 0, 0, .65); --neu-light: rgba(255, 255, 255, .05);
}

/* Style 2 · Neumorfismo */
button, a.button, .file-btn {
  background: var(--neu-base); color: var(--neu-ink); border: 1px solid var(--neu-edge);
  border-radius: 12px; padding: 8px 14px; min-height: 36px; font-weight: 600;
  box-shadow: var(--neu-raise);
  transition: box-shadow .15s ease, transform .15s ease, background-color .15s ease, color .15s ease;
}
button:hover:not(:disabled), a.button:hover, .file-btn:hover { box-shadow: var(--neu-raise-sm); }
button:active:not(:disabled), a.button:active, .file-btn:active,
button[aria-pressed="true"], button.active { box-shadow: var(--neu-press); transform: translateY(1px); }
button:focus-visible, a.button:focus-visible, .file-btn:focus-within { outline: 3px solid var(--brand-blue); outline-offset: 3px; }
button:disabled { box-shadow: none; transform: none; }
button.primary, a.button, .file-btn { background: var(--brand-primary); color: var(--brand-primary-ink); border-color: var(--brand-primary); }
button.primary:hover:not(:disabled), a.button:hover, .file-btn:hover { background: var(--brand-blue); border-color: var(--brand-blue); }
button.primary:active:not(:disabled) { box-shadow: inset 3px 3px 7px rgba(0, 0, 0, .35); }
button.danger { color: var(--error); }
button.danger-solid { background: var(--error); border-color: var(--error); color: #fff; }
button.mini { min-height: 0; padding: 3px 9px; border-radius: 8px; box-shadow: var(--neu-raise-sm); }
button.mini:active:not(:disabled) { box-shadow: inset 2px 2px 4px var(--neu-dark), inset -2px -2px 4px var(--neu-light); }
.bell-head button { min-height: 0; padding: 4px 9px; box-shadow: var(--neu-raise-sm); }
/* Pill tabs: the selected one stays pressed in, the rest stay raised */
.tabs button, .legal-tabs button, .legal-tabs a { background: var(--neu-base); color: var(--neu-ink); border-color: var(--neu-edge); box-shadow: var(--neu-raise-sm); }
.tabs button.active { background: var(--neu-base); color: var(--neu-ink); border-color: var(--neu-edge); box-shadow: var(--neu-press); }
/* Text-style buttons keep looking like links */
.link-btn, .legal-links button, .order-btns button, .help-btn { box-shadow: none; min-height: 0; transform: none !important; }
.link-btn, .legal-links button { background: none; border: 0; padding: 0; color: var(--link, var(--brand-blue)); font-weight: inherit; }
.legal-links button { color: inherit; }
.help-btn { padding: 0; border-radius: 50%; background: var(--neu-base); box-shadow: var(--neu-raise-sm); }
.help-btn:hover, .help-btn:focus-visible { background: var(--brand-blue); color: #fff; }

/* Style 3 · Glassmorphism on the dark brand areas */
.auth-card button, .topbar button, .command button, .history-nav button, .view-badge,
.command-head .help-btn {
  background: var(--glass-btn); color: #fff; border: 0;
  box-shadow: var(--glass-ring), var(--glass-drop);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.auth-card button:hover:not(:disabled), .topbar button:hover:not(:disabled), .command button:hover:not(:disabled),
.history-nav button:hover, .view-badge:hover, .command-head .help-btn:hover { background: var(--glass-btn-hover); color: #fff; box-shadow: var(--glass-ring), var(--glass-drop); }
.auth-card button:active:not(:disabled), .topbar button:active:not(:disabled), .command button:active:not(:disabled) { transform: scale(.98); box-shadow: var(--glass-ring); }
.auth-card button:focus-visible, .topbar button:focus-visible, .command button:focus-visible, .view-badge:focus-visible { outline-color: #fff; }
/* Main action on glass: frosted white with navy text */
.auth-card button.primary, .command button.primary {
  background: rgba(255, 255, 255, .92); color: var(--brand-navy); border: 0;
  box-shadow: var(--glass-ring), 0 10px 28px rgba(0, 10, 30, .35);
}
.auth-card button.primary:hover:not(:disabled), .command button.primary:hover:not(:disabled) { background: #fff; color: var(--brand-navy); }
.auth-card .link-btn { background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; color: #cfe6ff; }
.demo-grid button { border-radius: 12px; }
.history-nav button, .view-badge { min-height: 0; }
/* Popovers opened from the top bar are light surfaces: back to Neumorfismo there */
.topbar .user-pop button, .topbar .bell-pop button {
  background: var(--neu-base); color: var(--neu-ink); border: 1px solid var(--neu-edge);
  box-shadow: var(--neu-raise-sm); backdrop-filter: none; -webkit-backdrop-filter: none;
}
.topbar .user-pop button:hover:not(:disabled), .topbar .bell-pop button:hover:not(:disabled) { background: var(--neu-base); color: var(--neu-ink); box-shadow: var(--neu-raise-sm); }
.topbar .user-pop button:focus-visible, .topbar .bell-pop button:focus-visible { outline-color: var(--brand-blue); }
/* Side menu: the open module is a frosted glass tile */
.sidenav a.active {
  background: var(--glass-btn); color: #fff;
  box-shadow: var(--glass-ring), var(--glass-drop);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.sidenav a:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.command .kpi { box-shadow: var(--glass-ring); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

@media (prefers-reduced-motion: reduce) {
  button, a.button, .file-btn, .sidenav a { transition: none; }
  button:active, a.button:active { transform: none; }
}

/* ---------- Change 59: Atrás / Adelante on every screen, and shading of what is selected ---------- */
:root { --select-tint: color-mix(in srgb, var(--brand-blue) 11%, transparent); --select-ring: color-mix(in srgb, var(--brand-blue) 45%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --select-tint: color-mix(in srgb, var(--brand-blue) 20%, transparent); } }
:root[data-theme="dark"] { --select-tint: color-mix(in srgb, var(--brand-blue) 20%, transparent); }

/* Change 60: the bar sits at the foot of each screen and stays at the bottom of the window while scrolling */
.page-nav {
  display: flex; justify-content: space-between; gap: 8px; margin: 16px 0 0;
  position: sticky; bottom: 0; z-index: 6;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.page-nav button { min-height: 36px; padding: 6px 14px; font-size: .85rem; }

/* List rows and text-like buttons stay flat (they are not raised Neumorfismo buttons) */
.item, .tpl-item, .client-link, .cm-close { box-shadow: none; min-height: 0; transform: none !important; }
.item.selected, .tpl-item.selected { background: var(--select-tint); box-shadow: inset 3px 0 0 var(--brand-blue); }

/* Fields being filled in: the field and its label are lightly shaded */
form label:focus-within:not(.inline) { background: var(--select-tint); box-shadow: 0 0 0 6px var(--select-tint); border-radius: 6px; }
input:focus, select:focus, textarea:focus { background-color: color-mix(in srgb, var(--brand-blue) 6%, var(--surface)); }

/* Data of the client and of the case: the clicked datum stays shaded */
.facts > div { border-radius: 6px; cursor: pointer; transition: background-color .15s ease, box-shadow .15s ease; }
.facts > div:hover { background: color-mix(in srgb, var(--brand-blue) 5%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand-blue) 5%, transparent); }
.facts > div.is-selected { background: var(--select-tint); box-shadow: 0 0 0 6px var(--select-tint), 0 0 0 7px var(--select-ring); }
.facts > div:focus-visible { outline: 3px solid var(--brand-blue); outline-offset: 6px; }

/* "Ver:" tabs: the chosen one stays pressed and shaded, and so does its section */
.sec-nav button[aria-current], .sec-side button[aria-current], .view-head button[aria-current], .tabs button.active, .tabs button[aria-selected="true"] {
  background: var(--select-tint); color: var(--neu-ink); box-shadow: var(--neu-press); font-weight: 700;
}
.sec-current { box-shadow: 0 0 0 2px var(--select-ring), var(--shadow); background: color-mix(in srgb, var(--brand-blue) 4%, var(--surface)); }
section.sec-current { scroll-margin-top: 64px; }
#case-rows tr.row-link:hover td { background: var(--select-tint); }

@media (prefers-reduced-motion: reduce) { .facts > div { transition: none; } }
.public-nav { max-width: 860px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
/* Signer's page inside the test link (change 61) */
.sign-screen { min-height: 100vh; background: var(--bg, #f4f6f9); }
.sign-screen .public-wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; display: grid; gap: 16px; }
.sign-screen .pdf-frame { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 10px; }
.sign-screen .hash { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .76rem; word-break: break-all; color: var(--text-muted); }
.sign-code { margin-top: 8px; }
.send-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 10px 0; display: grid; gap: 8px; }
.send-card .send-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.send-card .send-step > span:first-child { min-width: 9rem; font-weight: 600; }
.send-card code { font-size: .95rem; letter-spacing: .08em; }
.signer-row .invalid { border-color: var(--danger, #c0392b); box-shadow: 0 0 0 2px rgba(192, 57, 43, .18); }

/* ---------- Version seal on the sign-in screen (change 62) ---------- */
.version-seal { display: flex; flex-direction: column; align-items: center; width: max-content; margin: 2px auto 18px; padding: 10px 26px 9px; border-radius: 16px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .3); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 8px 20px rgba(0, 10, 40, .35); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.version-seal[hidden] { display: none; }
.version-seal small { font-size: .6rem; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; opacity: .75; }
.version-seal b { font-family: var(--font-heading); font-weight: 400; font-size: 1.6rem; letter-spacing: .06em; line-height: 1.3;
  background: linear-gradient(90deg, #fff, var(--brand-silver-light), #fff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.version-seal > span { display: flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 500; opacity: .8; }
.version-seal i { width: 7px; height: 7px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 6px #3ddc84; }

/* ---------- «Novedades de la versión» (change 62) ---------- */
.news-dialog { width: min(620px, calc(100vw - 32px)); padding: 26px 28px 22px; border: 0; border-radius: 24px; background: #eef1f6;
  box-shadow: 14px 14px 32px rgba(0, 30, 80, .28), -10px -10px 26px rgba(255, 255, 255, .9); }
.news-dialog::backdrop { background: rgba(0, 20, 50, .35); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.news-top { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.news-top h3 { margin: 0; font-family: var(--font-heading); font-weight: 400; font-size: 1.1rem; color: var(--heading); }
.news-top p { margin: 4px 0 0; font-size: .85rem; }
.news-badge { flex: none; width: 80px; height: 80px; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--brand-navy), var(--brand-blue)); color: #fff; box-shadow: 6px 6px 14px rgba(0, 30, 80, .35), -5px -5px 12px #fff; }
.news-badge small { font-size: .55rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; opacity: .85; }
.news-badge b { font-family: var(--font-heading); font-weight: 400; font-size: 1.6rem; line-height: 1.3; }
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { display: flex; gap: 14px; padding: 12px 14px; margin: 10px 0; border-radius: 14px; background: #eef1f6;
  box-shadow: inset 3px 3px 7px rgba(0, 30, 80, .14), inset -3px -3px 7px #fff; }
.news-n { flex: none; width: 44px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: .78rem; color: var(--heading);
  background: #eef1f6; box-shadow: 3px 3px 6px rgba(0, 30, 80, .18), -3px -3px 6px #fff; }
.news-list li.is-current .news-n { background: var(--brand-navy); color: #fff; }
.news-list p { margin: 0; font-size: .86rem; line-height: 1.45; }
.news-list em { display: block; font-style: normal; color: var(--text-muted); font-size: .76rem; margin-top: 2px; }
.news-tag { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--brand-blue); color: #fff; font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; vertical-align: middle; }
.news-actions { display: flex; justify-content: flex-end; margin-top: 14px; }

/* ---------- Version line at the foot of the side menu (change 63) ---------- */
.nav-version { position: sticky; bottom: 0; margin: auto -12px -18px; padding: 12px 22px 14px; background: var(--nav-foot-bg);
  box-shadow: 0 -14px 14px var(--nav-foot-bg); color: rgba(196, 200, 203, .75);
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; }
.nav-version[hidden] { display: none; }
.nav-version-bar { display: block; height: 1px; margin-bottom: 9px; background: linear-gradient(90deg, rgba(2, 124, 198, .9), rgba(196, 200, 203, .25) 60%, transparent); }
.nav-version-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nav-version i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #3ddc84; margin-right: 7px; vertical-align: 1px; opacity: .85; }
.nav-version b { color: #e6e9ee; font-weight: 500; }
@media (max-width: 760px) {
  .nav-version { position: static; margin: 0; padding: 8px 12px; background: none; box-shadow: none; white-space: nowrap; align-self: center; }
  .nav-version-bar { display: none; }
}

/* ---------- Change 64: Atrás / Adelante inside every window ---------- */
dialog .dlg-nav { background: linear-gradient(to top, var(--surface) 70%, transparent); margin: 12px 0 0; padding-bottom: 0; bottom: -20px; }
.page-nav { align-items: center; }
.page-nav-step { flex: 1; text-align: center; font-size: .85rem; color: var(--text-muted); min-width: 0; }
.step-current { box-shadow: 0 0 0 2px var(--select-ring); border-radius: 10px; background: color-mix(in srgb, var(--brand-blue) 4%, transparent); scroll-margin-top: 16px; }
/* PDF preview: every page as an image (version 2.3) */
.pdf-view { display: grid; gap: 4px; max-height: 70vh; overflow: auto; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--text-muted, #888) 12%, transparent); }
.pdf-view .pdf-page { width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); border-radius: 2px; }
/* Signature spot over the preview (version 2.25): dashed box, moved by dragging when it is being chosen. */
.pdf-view .pdf-sheet { position: relative; line-height: 0; }
.pdf-view .stamp-mark { position: absolute; box-sizing: border-box; border: 2px dashed #027cc6; background: rgba(2, 124, 198, .14); color: #002b6a;
  font: 600 clamp(9px, 1.4vw, 12px)/1.2 system-ui, sans-serif; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px; border-radius: 3px; pointer-events: none; }
.pdf-view.stamp-picking .pdf-sheet { cursor: crosshair; }
.pdf-view.stamp-picking .stamp-mark { pointer-events: auto; cursor: grab; touch-action: none; background: rgba(2, 124, 198, .22); }
.pdf-view.stamp-dragging .stamp-mark { pointer-events: none; }
.pdf-view .stamp-mark:focus-visible { outline: 3px solid #002b6a; outline-offset: 1px; }
.pdf-view.stamp-picking .stamp-mark:active { cursor: grabbing; }
.pdf-view .pdf-page-label { text-align: center; font-size: .75rem; color: var(--text-muted); margin: 0 0 8px; }
#sign-doc-preview { margin-top: 12px; }
#sign-doc-preview > summary { cursor: pointer; font-weight: 600; }
/* Version 2.4: data policies answered Sí / No before signing by link */
.consent-fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 10px 0; }
.consent-fieldset legend { font-weight: 700; padding: 0 6px; color: var(--heading); }
.consent-label { margin: 0 0 8px; font-size: .9rem; }
.consent-choice { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.consent-choice label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.consent-choice input { width: 18px; height: 18px; }

/* Preview of the e-mail to a signer (version 2.8) */
.mail-preview { white-space: pre-wrap; word-break: break-word; font: .85rem/1.45 ui-monospace, Menlo, Consolas, monospace; background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; max-height: 320px; overflow: auto; margin: 6px 0 0; }

/* Select with a "+ Nuevo" button beside it (case form: process type and sub-process, Gerencia only). */
.select-add { display: flex; gap: 6px; align-items: center; }
.select-add > select { flex: 1; min-width: 0; }
.select-add > button[hidden] { display: none; }

/* Hidden users (version 2.11): the Gerencia strip above the users table. */
.hidden-users-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.hidden-users-bar .hidden-users-text { flex: 1 1 280px; }
.hidden-users-bar .row-actions { display: flex; flex-wrap: wrap; gap: 8px; white-space: normal; }
tr.is-hidden-user td { background: color-mix(in srgb, var(--warn) 6%, transparent); }

/* Version 2.17: upload box for templates (Gerencia) */
.tpl-drop { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; padding: 14px 16px; border: 2px dashed var(--brand-blue, #027cc6);
  border-radius: 14px; background: rgba(2, 124, 198, 0.06); color: var(--brand-primary, #002b6a); cursor: pointer; text-align: center; }
.tpl-drop[hidden] { display: none; }
.tpl-drop strong { font-size: 1rem; }
.tpl-drop span { font-size: .85rem; opacity: .85; }
.tpl-drop:hover, .tpl-drop.is-over { background: rgba(2, 124, 198, 0.14); }
.tpl-drop:focus-within { outline: 3px solid var(--brand-blue, #027cc6); outline-offset: 3px; }

/* Version 2.18: folder numbers on the client screen and the task history of a case */
.folder-tag.none { border-style: dashed; border-color: var(--brand-silver); color: var(--text-muted); font-weight: 600; }
.folder-table td.folder-act { text-align: right; white-space: nowrap; }
.tlog-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 10px; }
.tlog-filter label { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; }
.tlog-filter select { min-width: 220px; }
.tlog-table td.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Version 2.19: client pickers are search boxes (JuanmaCombo.searchSelect); the real <select> stays for the form. */
.select-search { position: relative; display: block; }
.select-search > input { width: 100%; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2716%27 height=%2716%27 fill=%27none%27 stroke=%27%23989795%27 stroke-width=%272%27 stroke-linecap=%27round%27%3E%3Ccircle cx=%277%27 cy=%277%27 r=%275%27/%3E%3Cpath d=%27m11 11 4 4%27/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 12px center !important; }
.select-search > .select-search-native { position: absolute; inset: auto 0 0 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; }
.select-search .combo-list { max-height: 320px; overflow-y: auto; }
.toolbar .select-search { display: inline-block; min-width: 260px; }

/* Version 2.22: optional client photo */
.photo-field { display: flex; gap: 14px; align-items: center; margin: 10px 0; }
.photo-field .toolbar { margin-top: 6px; flex-wrap: wrap; }
.photo-field .hint { margin: 2px 0 0; }
.client-photo { flex: none; width: 72px; height: 72px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--select-tint, #e8eef6); color: #002b6a; font-weight: 700; font-size: 1.4rem; border: 2px solid #c4c8cb; }
.client-photo.big { width: 112px; height: 112px; font-size: 2rem; }
.client-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-box { background: #0b1a33; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; max-width: 560px; margin: 8px auto; }
.camera-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-box video.mirror { transform: scaleX(-1); }
@media (max-width: 560px) { .client-photo.big { width: 88px; height: 88px; } }
/* «Cargar radicados» (version 2.24) */
.rad-progress { margin: 0 0 .6rem; }
.rad-table td { vertical-align: top; }
.rad-cell { min-width: 370px; }
.rad-edit { display: flex; gap: .4rem; align-items: center; }
.rad-edit .rad-input { flex: 1; min-width: 0; font-size: .85rem; letter-spacing: 0; }
.rad-note, .rad-old { display: block; font-size: .8rem; margin-top: .25rem; }
.rad-note.ok { color: var(--ok); font-weight: 600; }
.rad-note.bad { color: var(--error); font-weight: 600; }
.rad-table tr.has-rad .rad-input { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
@media (max-width: 720px) {
  .rad-table thead { display: none; }
  .rad-table tr { display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; padding: .5rem 0; }
  .rad-table td { border: 0; padding: .15rem .3rem; }
  .rad-table td:nth-child(3), .rad-table td.rad-cell { grid-column: 1 / -1; min-width: 0; }
}

/* Version 2.26: «Notificar al asignado» */
.notify-box { border-color: var(--select-tint, #c4c8cb); }
.notify-box .radio-row { align-items: center; }
.notice-results { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .5rem; }
.notice-results li { padding: .5rem .75rem; border-radius: 10px; background: rgba(2, 124, 198, .06); }
.notice-results li .follow { margin-right: .4rem; }
.notice-text pre { white-space: pre-wrap; font: inherit; font-size: .9rem; max-height: 14rem; overflow: auto; background: rgba(0, 43, 106, .05); padding: .6rem; border-radius: 8px; }

/* Addressee of e-mails, petitions and templates (version 2.27) */
.recipient-box { margin: 10px 0; }
.recipient-box .recipient-preview { align-self: end; padding: 8px 10px; border-left: 3px solid var(--blue, #027cc6); background: var(--select-tint, rgba(2,124,198,.06)); border-radius: 6px; font-size: .92em; line-height: 1.35; }
.recipient-box .recipient-preview:empty { display: none; }
/* Version 2.32: Atrás / Adelante also in the sign-in card and in the pop-up lists (notifications, user menu, client menu) */
.auth-nav { position: static; background: none; margin: 14px 0 0; padding: 10px 0 0; border-top: 1px solid var(--glass-border); }
.pop-nav { background: linear-gradient(to top, var(--surface) 70%, transparent); margin: 6px 0 0; padding: 8px 0; }
.bell-pop .pop-nav { padding: 8px 12px; }
.user-pop .pop-nav button { width: auto; }

/* ---------- Crossfade, magnification and blur (versions 2.34, 2.40) ----------
   They run while <html data-fx="on"> (display.js): Pantalla → «Efectos» = Siempre (default), Como el equipo
   (off when the device asks for reduced motion, e.g. Windows with animations turned off) or Sin efectos.
   Crossfade: screens and the Documentos tabs cross-fade (View Transitions, started in app.js), windows, their
   backdrop, the sign-in / app screens and the pop-up lists fade in and out. Blur: the outgoing and incoming
   screens blur mid-way (the top bar and side menu keep their own layer and stay sharp); windows blur what is behind. */
@keyframes jm-vt-out { to { opacity: 0; filter: blur(8px); } }
@keyframes jm-vt-in { from { opacity: 0; filter: blur(8px); } }
:root[data-fx="on"]::view-transition-old(root) { animation: jm-vt-out .2s ease both; }
:root[data-fx="on"]::view-transition-new(root) { animation: jm-vt-in .2s ease both; }
#app-root .topbar { view-transition-name: jm-topbar; }
.sidenav { view-transition-name: jm-sidenav; }
:root[data-fx="on"] dialog { opacity: 0; transform: scale(.96); transition: opacity .3s ease, transform .3s ease, overlay .3s ease allow-discrete, display .3s ease allow-discrete; }
:root[data-fx="on"] dialog[open] { opacity: 1; transform: none; }
dialog:not([open]) { pointer-events: none; }
:root[data-fx="on"] dialog::backdrop { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s ease, overlay .3s ease allow-discrete, display .3s ease allow-discrete; }
:root[data-fx="on"] dialog[open]::backdrop { opacity: 1; }
:root[data-fx="on"] .bell-pop, :root[data-fx="on"] .user-pop, :root[data-fx="on"] .client-menu { -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
@starting-style {
  :root[data-fx="on"] dialog[open] { opacity: 0; transform: scale(.96); }
  :root[data-fx="on"] dialog[open]::backdrop { opacity: 0; }
}
@keyframes jm-fade-in { from { opacity: 0; } to { opacity: 1; } }
:root[data-fx="on"] :is(#auth-screen, #app-root, #sign-screen, [data-dpanel]):not([hidden]),
:root[data-fx="on"] details[open] > :is(.bell-pop, .user-pop), :root[data-fx="on"] .client-menu { animation: jm-fade-in .3s ease; }

/* Magnification: with a mouse, what is under the pointer grows: buttons, cards and the side-menu entries
   (dock style: the icon grows most and the neighbouring entries grow half as much). Touch keeps the press effect. */
@media (any-hover: hover) {
  :root[data-fx="on"] :is(button:not(:disabled), a.button, .file-btn, .kpi, .case-open, .sidenav a) { transition: box-shadow .2s ease, transform .2s cubic-bezier(.2, .7, .3, 1.3), background-color .2s ease, color .2s ease, border-color .2s ease; }
  :root[data-fx="on"] :is(button:hover:not(:disabled), a.button:hover, .file-btn:hover) { transform: scale(1.1); }
  :root[data-fx="on"] button.mini:hover:not(:disabled) { transform: scale(1.14); }
  :root[data-fx="on"] :is(.kpi, .case-open):hover { transform: scale(1.05); }
  :root[data-fx="on"] .sidenav a { transform-origin: left center; }
  :root[data-fx="on"] .sidenav a:hover { transform: scale(1.07); }
  :root[data-fx="on"] .sidenav a:is(:has(+ a:hover), a:hover + a) { transform: scale(1.035); }
  :root[data-fx="on"] .sidenav a .ico { transition: transform .2s cubic-bezier(.2, .7, .3, 1.3); }
  :root[data-fx="on"] .sidenav a:hover .ico { transform: scale(1.4); }
  :root[data-fx="on"] .sidenav a:is(:has(+ a:hover), a:hover + a) .ico { transform: scale(1.2); }
  :root[data-fx="on"] :is(button:active:not(:disabled), a.button:active, .file-btn:active) { transform: scale(1.03) translateY(1px); }
}

/* Version 2.41: optional photo of the funcionario (user) */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.client-photo.small { width: 40px; height: 40px; font-size: .85rem; border-width: 1px; }
.user-cell { display: flex; align-items: center; gap: 10px; }

/* Version 2.61: role check list in the case form */
.role-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.role-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 12px; font-size: .85rem; background: var(--surface-muted); cursor: pointer; }
.role-chip.on { background: var(--brand-navy); color: #fff; }
.ad-litem-box { align-self: end; }
.muted-line { display: block; margin: 4px 0; font-weight: 600; } .muted-line strong { display: inline; }
.role-chips { gap: 18px; }

/* Importar: three file cards */
#import-kind-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.import-card { padding: 12px; border-radius: 12px; background: var(--surface, #fff); box-shadow: 4px 4px 10px rgba(0,0,0,.08), -4px -4px 10px rgba(255,255,255,.7); }
.import-card h4 { margin: 0 0 6px; }
.import-card .toolbar { flex-wrap: wrap; gap: 6px; }

/* Version 2.87: breakdown links inside Inicio's «Clientes con Casos de Éxito!» tile. */
.kpi .kpi-label a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.kpi .kpi-label a:hover { text-decoration-thickness: 2px; }
.recent.moves li { grid-template-columns: auto 1fr auto; }
.recent.moves li div strong, .recent.moves li div span { white-space: normal; }
#dash-moves-panel { margin-top: 16px; }
#dash-moves-more a { color: var(--brand-blue, #027cc6); font-weight: 600; }
/* Version 2.96: the longest status («Pendiente Pago Sentencia») must not spill over the recent-movement rows. */
.recent li > span:last-child { max-width: 9rem; text-align: right; overflow-wrap: anywhere; font-size: .8rem; }

/* Version 2.98: the case row's action bar (user's choice «C»): five equal columns, icon over name. */
#case-rows .row-actions { min-width: 400px; }
.case-bar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.ico-btn { display: grid; justify-items: center; align-content: center; gap: 3px; padding: 8px 2px; margin: 0 !important; font-size: .7rem; line-height: 1.15; white-space: normal; text-align: center; min-width: 0; overflow-wrap: normal; word-break: normal; }
.ico-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico-btn.danger { color: var(--error, #b3261e); }
@media (max-width: 560px) { .case-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); } #case-rows .row-actions { min-width: 0; } }

/* Version 2.99: client state selector and bar (user's choice «C»). */
.state-sel { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted, #5d6b85); }
.state-sel select { width: auto; min-width: 12rem; font-weight: 600; }
.detail-head { flex-wrap: wrap; }
.client-bar { flex: 1 1 100%; }
.client-bar .sp { flex: 1; }
#client-archive { min-width: 14rem; }
#client-order { min-width: 12rem; }

/* ---------- Inicio: banda de clima, emisoras y noticias (version 2.2.7) ---------- */
.banda { margin: 0 0 16px; padding: 12px; border-radius: 16px; background: var(--command-tile); border: 1px solid rgba(255, 255, 255, .12); }
.banda-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.banda-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.banda-tabs button[aria-selected="true"] { background: rgba(255, 255, 255, .92); color: var(--brand-navy); }
.banda .ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.banda-body { min-height: 96px; padding: 12px 16px; border-radius: 14px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); color: var(--on-dark); display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.banda-clima { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.banda-now { display: flex; flex-direction: column; }
.banda-place { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--k1); font-weight: 600; }
.banda-temp { font-size: 2.6rem; font-weight: 800; line-height: 1; color: #fff; }
.banda-det { display: flex; flex-direction: column; gap: 2px; font-size: .88rem; }
.banda-det .ico { margin-bottom: 2px; }
.banda-days { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.banda-days div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 10px; background: rgba(255, 255, 255, .08); font-size: .78rem; text-transform: capitalize; }
.banda-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.banda a.button { text-decoration: none; padding: 6px 12px; background: var(--glass-btn); color: #fff; border: 0; box-shadow: var(--glass-ring), var(--glass-drop); border-radius: 999px; font-weight: 600; }
.banda a.button:hover { background: var(--glass-btn-hover); }
.banda a.button.small { padding: 3px 10px; font-size: .78rem; }
.banda a.button.link { display: block; padding: 0; background: none; box-shadow: none; border-radius: 0; font-weight: 600; text-align: left; }
.banda a.button.link:hover { text-decoration: underline; background: none; }
.banda-news { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.banda-news li span { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--k1); font-weight: 600; }
.banda-msg, .banda-note { margin: 0; font-size: .86rem; color: var(--on-dark-muted); }
.banda-dots { display: flex; justify-content: center; gap: 5px; margin-top: 8px; }
.banda-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .3); }
.banda-dots i.on { background: #fff; }
@media (max-width: 560px) { .banda-tabs button { padding-inline: 6px; font-size: .86rem; } .banda-days { min-width: 0; flex-basis: 100%; } }

/* Mony, asistente jurídico (versión 2.2.8): azul medianoche #0F172A, cian eléctrico, gris pizarra */
.mony-log { display: flex; flex-direction: column; gap: 10px; min-height: 260px; max-height: 58vh; overflow-y: auto; padding: 14px; border-radius: 16px; background: #0F172A; border: 1px solid #243352; }
.mony-msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.mony-user { align-self: flex-end; background: #22d3ee; color: #06243a; font-weight: 500; }
.mony-assistant { align-self: flex-start; background: #1e293b; color: #e2e8f0; border: 1px solid #334155; }
.mony-typing { opacity: .7; font-style: italic; }
.mony-error { background: #3b1620; color: #fda4af; border-color: #7f1d33; }
.mony-tags { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; }
.mony-tag { font-size: .78rem; padding: 3px 10px; border-radius: 99px; border: 1px solid #22d3ee66; background: #22d3ee14; color: #67e8f9; }
.mony-tag-running { animation: mony-pulse 1.1s ease-in-out infinite; }
.mony-tag-ok { color: #6ee7b7; border-color: #34d39966; background: #34d39914; }
.mony-tag-error { color: #fda4af; border-color: #fb718566; background: #fb718514; }
@keyframes mony-pulse { 50% { opacity: .45; } }
.mony-cards { align-self: flex-start; display: flex; flex-direction: column; gap: 8px; max-width: 82%; width: 100%; }
.mony-card { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 14px; background: #0b1426; border: 1px solid #22d3ee66; color: #e2e8f0; box-shadow: 0 0 14px #22d3ee1f; }
.mony-card > div:not(.mony-count) { flex: 1; min-width: 0; }
.mony-card b, .mony-card small { display: block; overflow-wrap: anywhere; }
.mony-card small { color: #94a3b8; }
.mony-count { width: 54px; height: 54px; flex: none; border-radius: 50%; display: grid; place-content: center; text-align: center; font-size: 1.35rem; font-weight: 800; line-height: 1; color: #22d3ee; border: 3px solid #22d3ee; }
.mony-count small { font-size: .62rem; font-weight: 500; }
.mony-urgent .mony-count { color: #fb7185; border-color: #fb7185; }
.mony-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.mony-form textarea { flex: 1; resize: vertical; }
@media (max-width: 560px) { .mony-msg, .mony-cards { max-width: 94%; } }
.mony-id { display: flex; align-items: center; gap: 18px; padding: 12px 18px; margin-bottom: 8px; border-radius: 14px; background: #0F172A; border: 1px solid #243352; color: #e2e8f0; }
.mony-id img, .mony-id .mony-cv { width: 168px; height: 168px; border-radius: 50%; filter: drop-shadow(0 0 10px #22d3ee88); }
.mony-id b { display: block; letter-spacing: .1em; }
.mony-id small { color: #6ee7b7; }
.mony-id img { transition: transform .12s ease-out; will-change: transform; }
@media (prefers-reduced-motion: reduce) { .mony-id img { transition: none; } }
.mony-id img, .mony-id .mony-cv { cursor: zoom-in; }
.mony-zoom { border: 1px solid #22d3ee66; border-radius: 22px; background: #0F172A; color: #e2e8f0; padding: 20px; text-align: center; max-width: min(92vw, 560px); box-shadow: 0 0 40px #22d3ee33; }
.mony-zoom::backdrop { background: #020617cc; }
.mony-zoom img, .mony-zoom .mony-cv { width: min(80vw, 440px); height: auto; aspect-ratio: 1; border-radius: 50%; filter: drop-shadow(0 0 18px #22d3ee88); }
.mony-zoom p { margin: 10px 0 12px; letter-spacing: .08em; }
.mony-zoom .page-nav { background: transparent; box-shadow: none; border: 0; }
.mony-id b { font-size: 1.4rem; }
.mony-zoom { max-width: min(96vw, 620px); }
.mony-zoom img, .mony-zoom .mony-cv { width: min(86vw, 504px); transition: transform .12s ease-out; will-change: transform; }
.mony-zoom.full { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #020617; overflow: hidden; }
.mony-zoom.full img, .mony-zoom.full .mony-cv { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; object-fit: contain; filter: none; }
.mony-zoom.full p, .mony-zoom.full .page-nav { display: none; }
.mony-zoom.full #mony-zoom-close { position: fixed; top: 14px; right: 14px; z-index: 2; }
@media (max-width: 560px) { .mony-id img, .mony-id .mony-cv { width: 120px; height: 120px; } }
@media (prefers-reduced-motion: reduce) { .mony-zoom img { transition: none; } }

/* Mony flotante (versión 2.2.13) */
.mony-fab { position: fixed; right: 22px; bottom: 84px; z-index: 40; width: 68px; height: 68px; padding: 0; border: 0; border-radius: 50%; background: #0F172A; cursor: pointer;
  box-shadow: 0 6px 20px #0008, 0 0 0 3px #22d3ee, 0 0 22px #22d3ee88; transition: transform .15s ease; }
.mony-fab:hover, .mony-fab:focus-visible { transform: scale(1.08); }
.mony-fab img, .mony-fab .mony-cv { width: 100%; height: 100%; border-radius: 50%; display: block; transition: transform .12s ease-out; pointer-events: none; }
.mony-fab i { position: absolute; right: 2px; bottom: 2px; width: 15px; height: 15px; border-radius: 50%; background: #34d399; border: 2px solid #0F172A; }
.mony-fab::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid #22d3ee; opacity: 0; animation: mony-ring 2.8s ease-out infinite; pointer-events: none; }
@keyframes mony-ring { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(1.35); opacity: 0; } }
.mony-panel { position: fixed; right: 22px; bottom: 84px; z-index: 41; width: min(400px, calc(100vw - 24px)); height: min(620px, calc(100vh - 110px)); display: flex; flex-direction: column;
  border-radius: 20px; background: #0F172A; border: 1px solid #22d3ee66; box-shadow: 0 18px 50px #000a, 0 0 28px #22d3ee33; overflow: hidden; color: #e2e8f0; }
.mony-panel[hidden] { display: none; }
.mony-panel header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #243352; background: #111c36; }
.mony-panel header img, .mony-panel header .mony-cv { width: 44px; height: 44px; border-radius: 50%; filter: drop-shadow(0 0 6px #22d3ee88); }
.mony-panel header div { flex: 1; min-width: 0; }
.mony-panel header b { display: block; letter-spacing: .1em; }
.mony-panel header small { color: #6ee7b7; }
.mony-panel-btn { border: 1px solid #334155; background: #1e293b; color: #e2e8f0; border-radius: 10px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: .85rem; }
.mony-panel-btn:hover { border-color: #22d3ee; }
#mony-panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px; }
#mony-panel-body #mony-body, #mony-panel-body #mony-box { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#mony-panel-body .mony-log { flex: 1; max-height: none; min-height: 0; }
#mony-panel-body .mony-form textarea { min-height: 0; }
#mony-panel-body .server-note { color: #1e293b; }
@media (max-width: 560px) { .mony-fab { right: 14px; bottom: 76px; width: 60px; height: 60px; } .mony-panel { right: 8px; left: 8px; width: auto; bottom: 70px; height: calc(100vh - 90px); } }
@media (prefers-reduced-motion: reduce) { .mony-fab::after { animation: none; } .mony-fab { transition: none; } }
#mony-panel-body textarea { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; }
#mony-panel-body textarea::placeholder { color: #94a3b8; }
@media (max-width: 560px) { .mony-panel { height: calc(100vh - 170px); } }

/* Voz de Mony (versión 2.2.14) */
.mony-actions { align-self: flex-start; margin-top: -4px; }
.mony-speak { border: 1px solid #334155; background: #1e293b; color: #94a3b8; border-radius: 99px; padding: 2px 10px; font: inherit; font-size: .78rem; cursor: pointer; }
.mony-speak:hover, .mony-speak.on { color: #67e8f9; border-color: #22d3ee; }
.mony-speak.on { animation: mony-pulse 1.1s ease-in-out infinite; }
.mony-voice { margin-left: auto; border: 1px solid #334155; background: #1e293b; color: #e2e8f0; border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.mony-voice[aria-pressed="true"] { border-color: #22d3ee; color: #67e8f9; }
.mony-voice[hidden], .mony-mic[hidden], .mony-speak[hidden] { display: none; }
.mony-panel .mony-voice { margin-left: 0; padding: 6px 8px; font-size: .78rem; }
.mony-mic { border: 1px solid #334155; background: #1e293b; color: #e2e8f0; border-radius: 12px; padding: 0 12px; font-size: 1.1rem; cursor: pointer; min-height: 40px; }
.mony-mic.on { background: #ef4444; border-color: #ef4444; animation: mony-pulse 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .mony-speak.on, .mony-mic.on { animation: none; } }

.mony-cv { display: block; }
.mony-zoom .mony-cv { margin: 0 auto; }
.mony-zoom.full .mony-cv { margin: 0; object-fit: contain; }
#mony-body { transition: opacity 1.1s ease, transform 1.1s ease; }
#mony-body.mony-intro { opacity: 0; transform: translateY(14px); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #mony-body { transition: none; } }
.mony-voice-box { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.mony-voice-box .mony-voice { margin-left: 0; }
.mony-voice-pick { max-width: 220px; border: 1px solid #334155; background: #1e293b; color: #e2e8f0; border-radius: 10px; padding: 5px 8px; font: inherit; font-size: .8rem; }
.mony-voice-pick[hidden] { display: none; }
@media (max-width: 560px) { .mony-panel { top: 8px; bottom: 12px; height: auto; z-index: 60; } }
@media (max-width: 560px) { .mony-panel header { flex-wrap: wrap; row-gap: 6px; } .mony-panel header small { white-space: nowrap; } .mony-panel header div { flex: 1 1 120px; min-width: 0; } }
.mony-wa { flex-direction: column; align-items: stretch; }
.mony-wa-text { width: 100%; margin-top: 6px; background: #0f172a; color: #e2e8f0; border: 1px solid #22d3ee55; border-radius: 10px; padding: 8px; font: inherit; resize: vertical; }
.mony-wa-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mony-mail-body { white-space: pre-wrap; max-height: 180px; overflow: auto; margin: 6px 0 8px; padding: 8px; border-radius: 10px; background: #0f172a; border: 1px solid #22d3ee33; font-size: 13px; }
.mony-panel header img, .mony-panel header .mony-cv { cursor: zoom-in; }
.mony-conflict { margin: 6px 0; padding: 6px 8px; border-radius: 8px; background: #7f1d1d55; border: 1px solid #f8717199; color: #fecaca; font-size: 13px; }
.mony-wa-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
/* Version 2.2.27: phones. 16 px inputs stop iOS from zooming the page when the chat box is focused; the voice button stays compact. */
@media (max-width: 560px) {
  #mony-input { font-size: 16px; }
  .mony-panel .mony-voice { font-size: 12px; padding: 6px 10px; }
  .mony-card { max-width: 100%; }
  .mony-wa-text { font-size: 16px; }
}

/* ---------- Versión móvil (2.2.28): versión visible y Mony ajustado a pantallas pequeñas; escritorio no cambia ---------- */
.top-version { display: none; }
.top-version b { font-weight: 600; letter-spacing: .04em; }
@media (max-width: 760px) {
  .brand .tagline:not(.top-version) { display: none; }
  .brand .top-version:not([hidden]) { display: block; }
  .nav-version { display: none; }
  .brand { min-width: 0; }
  .brand h1 { font-size: 1.1rem; letter-spacing: .05em; overflow-wrap: anywhere; }
}
@media (max-width: 560px) {
  .mony-id { flex-wrap: wrap; gap: 8px 14px; padding: 12px; }
  .mony-id > div:not(.mony-voice-box) { flex: 1 1 0; min-width: 0; }
  .mony-id b { font-size: 1.2rem; }
  .mony-id small { overflow-wrap: anywhere; }
  .mony-voice-box { margin-left: 0; width: 100%; align-items: stretch; }
  .mony-voice-box .mony-voice { width: 100%; }
  .mony-voice-pick { max-width: none; width: 100%; }
  .mony-panel header .mony-panel-btn { flex: 1 1 0; min-width: 0; white-space: nowrap; }
  .mony-panel header .mony-voice { flex: 3 1 0; }
  .mony-panel header #mony-panel-close { flex: 0 0 52px; }
  .mony-panel header div { flex: 1 1 calc(100% - 64px); }
  .mony-panel .mony-voice { padding: 6px 8px; }
  .mony-form { gap: 6px; }
  .mony-form textarea { min-width: 0; }
  .mony-fab { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
/* v2.2.35: buscador de clientes registrados dentro de las partes */
.party-pick { margin-top: 6px; position: relative; }
.party-pick input { width: 100%; }
.party-pick-list { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); display: grid; gap: 2px; }
.party-pick-list button { width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 6px; cursor: pointer; font: inherit; color: inherit; }
.party-pick-list button:hover, .party-pick-list button:focus-visible { background: var(--surface-muted); }

/* Version 2.2.46: objetos contractuales */
.cobj-item { margin: 8px 0; }
.cobj-item.off { opacity: .65; }
.cobj-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cobj-clause { white-space: pre-wrap; margin: 6px 0; color: var(--muted, inherit); }
.cobj-preview { white-space: pre-wrap; font: inherit; margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(0, 0, 0, .04); }

/* Version 2.2.48: asistente por pasos «Contrato o poder» */
.wz-bar { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 8px 0 14px; }
.wz-bar li { display: flex; align-items: center; gap: 6px; opacity: .55; }
.wz-bar li.now { opacity: 1; font-weight: 700; }
.wz-bar li.done { opacity: 1; }
.wz-bar li.done .step-no { background: var(--ok, #2e7d32); color: #fff; }
.wz-step { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: rgba(0, 43, 106, .04); }
.wz-step h4 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.wz-step select[size] { width: 100%; }
/* Version 2.3.56: the chosen client stays highlighted in the list (also when the list loses focus) and is named below it. */
.wz-step select[size] option:checked { background: #027cc6 linear-gradient(0deg, #027cc6, #027cc6); color: #fff; font-weight: 700; }
.wz-chosen { margin: 6px 0 0; font-weight: 700; color: #3ddc97; }
#wz-host #tpl-active { display: flex; flex-direction: column; }
#wz-host .output-head { display: contents; }
#wz-host #tpl-case-label, #wz-host #tpl-fees { display: none !important; }
#wz-host .actions { order: 90; display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(0, 43, 106, .15); }
#wz-host .actions::before { content: "Generar el documento"; flex-basis: 100%; font-weight: 700; }

/* Version 2.2.52: installments of the fixed fee in the contract checklist */
.fee-inst { margin: .5rem 0; }
.fee-inst-fields { display: grid; gap: .5rem; margin-top: .5rem; padding-left: .75rem; border-left: 3px solid var(--select-tint, #c4c8cb); }
.fee-inst .inst-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }

/* Inicio: audiencias y vencimientos que abren su expediente (version 2.2.77) */
.recent li.linked { cursor: pointer; transition: background .15s, transform .15s; }
.recent li.linked:hover, .recent li.linked:focus-visible { background: var(--surface-hover, rgba(2, 124, 198, .12)); transform: translateX(2px); outline: none; }
.recent li.linked:focus-visible { box-shadow: 0 0 0 2px var(--accent, #027cc6); }
.recent li.linked.late:hover, .recent li.linked.late:focus-visible { box-shadow: inset 3px 0 0 var(--error); }

/* Version 2.2.79: grouped case buttons (Editar / Consultar en Rama Judicial / Generar documento) */
.btn-group { position: relative; }
.btn-group > summary { list-style: none; cursor: pointer; font-size: .85rem; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-muted); color: var(--text); white-space: nowrap; user-select: none; }
.btn-group > summary::-webkit-details-marker { display: none; }
.btn-group > summary::after { content: " ▾"; }
.btn-group > summary.primary { background: var(--brand-primary); color: var(--brand-primary-ink); border-color: var(--brand-primary); }
.btn-group[open] > summary { box-shadow: 0 0 0 2px var(--accent, #027cc6); }
.btn-group-pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; min-width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.btn-group-pop button { text-align: left; white-space: nowrap; }
@media (max-width: 760px) { .btn-group-pop { max-width: calc(100vw - 32px); } .btn-group-pop button { white-space: normal; } }

.chip-copy { position: relative; padding-right: 34px; }
.copy-ico { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; margin: 0 !important; border-radius: 50%; min-width: 0; }
.copy-ico svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Chat between users and video calls (version 2.2.82) ---------- */
.nav-badge { background: var(--error, #c0392b); color: #fff; font-size: .68rem; font-weight: 700; line-height: 1; min-width: 18px; padding: 3px 5px; border-radius: 999px; text-align: center; flex: none; }
.sidenav a { position: relative; }
.sidenav a > .nav-badge { position: absolute; top: 4px; right: 6px; }
.nav-badge.calling { background: var(--ok, #2e7d4f); }
.chat-app { display: grid; grid-template-columns: 310px 1fr; gap: 14px; min-height: 480px; height: calc(100vh - 230px); }
.chat-side, .chat-main, .chat-empty { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; min-height: 0; }
.chat-side { display: flex; flex-direction: column; overflow-y: auto; padding: 10px; gap: 6px; }
.chat-side-top { display: flex; gap: 6px; }
.chat-side-top input { flex: 1; min-width: 0; }
.chat-sub-title { margin: 10px 4px 2px; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); box-shadow: none; cursor: pointer; }
.chat-row:hover { background: var(--surface-muted); }
.chat-row.active { background: var(--select-tint, rgba(2, 124, 198, .12)); border-color: var(--select-ring, var(--brand-blue)); }
.chat-row-t { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.chat-row-t strong, .chat-row-t small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-t small { color: var(--text-muted); font-size: .76rem; font-weight: 400; }
.chat-av { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: #fff; background: hsl(var(--h, 210) 45% 38%); }
.chat-av.grp { background: var(--brand-primary); font-size: 1rem; }
.chat-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-silver, #989795); border: 2px solid var(--surface); }
.chat-dot.on { background: var(--ok, #2e7d4f); }
.chat-main { display: flex; flex-direction: column; overflow: hidden; }
.chat-main[hidden], .chat-empty[hidden] { display: none; }
.chat-empty { display: grid; place-items: center; color: var(--text-muted); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.chat-head-t { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.chat-head-t small { color: var(--text-muted); }
.chat-head-b { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chat-list-btn { display: none; }
.chat-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: var(--select-tint, rgba(46, 125, 79, .14)); border-bottom: 1px solid var(--border); font-size: .88rem; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 70px 14px 14px; /* room for the floating arrow buttons */ display: flex; flex-direction: column; gap: 6px; }
.chat-day { display: grid; place-items: center; margin: 8px 0 2px; }
.chat-day span { font-size: .72rem; color: var(--text-muted); background: var(--surface-muted); padding: 2px 10px; border-radius: 999px; text-transform: capitalize; }
.chat-sys { align-self: center; font-size: .8rem; color: var(--text-muted); padding: 4px 10px; border-radius: 999px; background: var(--surface-muted); }
.chat-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 82%; }
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.focus .chat-bubble { outline: 2px solid var(--brand-blue); }
.chat-bubble { background: var(--surface-muted); border-radius: 14px 14px 14px 4px; padding: 7px 11px; min-width: 70px; overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { background: var(--brand-primary); color: var(--brand-primary-ink); border-radius: 14px 14px 4px 14px; }
.chat-bubble p { margin: 0; line-height: 1.4; }
.chat-bubble a { color: inherit; text-decoration: underline; }
.chat-from { display: block; font-size: .74rem; color: var(--brand-blue); margin-bottom: 2px; }
.chat-at { background: rgba(255, 200, 40, .35); color: inherit; border-radius: 4px; padding: 0 2px; }
.chat-gone { opacity: .7; }
.chat-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: .68rem; opacity: .75; margin-top: 2px; }
.chat-ticks.read { color: #5ad0ff; }
.chat-act { border: 0; background: transparent; box-shadow: none; padding: 0 3px; font-size: .78rem; cursor: pointer; opacity: 0; color: inherit; min-height: 0; }
.chat-msg:hover .chat-act, .chat-act:focus-visible { opacity: 1; }
@media (hover: none) { .chat-act { opacity: .8; } }
.chat-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .82rem; text-decoration: none !important; cursor: pointer; max-width: 100%; }
.chat-msg.mine .chat-chip { color: var(--text); }
.chat-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 14px 0; }
.chat-x { border: 0; background: transparent; box-shadow: none; padding: 0 2px; min-height: 0; cursor: pointer; color: inherit; }
.chat-form { position: relative; display: flex; gap: 6px; align-items: flex-end; padding: 10px 84px 10px 14px; /* clear of the Mony button */ border-top: 1px solid var(--border); }
.chat-form textarea { flex: 1; resize: none; min-height: 38px; max-height: 140px; }
.chat-form.editing textarea { outline: 2px solid var(--warn, #a8670a); }
.chat-mention { position: absolute; left: 14px; bottom: calc(100% - 4px); display: flex; flex-direction: column; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow, 0 6px 20px rgba(0,0,0,.2)); overflow: hidden; z-index: 3; }
.chat-mention[hidden] { display: none; }
.chat-mention button { display: flex; align-items: center; gap: 8px; text-align: left; border: 0; border-radius: 0; box-shadow: none; background: transparent; color: var(--text); }
.chat-mention button:hover { background: var(--surface-muted); }
.chat-older { align-self: center; }
.chat-none { align-self: center; margin: auto; }
.chat-live { font-size: .8rem; }
.chat-check { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.chat-pick { border: 1px solid var(--border); border-radius: 10px; max-height: 260px; overflow-y: auto; }
.chat-link-list { max-height: 320px; overflow-y: auto; margin: 10px 0; }
#chat-found[hidden], #chat-convs[hidden] { display: none; }
/* Video call: a full-window dialog with a grid of tiles */
dialog.chat-call { width: min(1100px, 100vw - 16px); height: min(760px, 100vh - 16px); max-height: none; display: none; flex-direction: column; gap: 10px; background: #060b16; color: #e8f2ff; border-color: rgba(0, 240, 255, .25); }
dialog.chat-call[open] { display: flex; }
.call-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.call-grid { flex: 1; min-height: 0; display: grid; gap: 8px; grid-template-columns: 1fr; grid-auto-rows: 1fr; }
.call-grid[data-n="2"] { grid-template-columns: 1fr 1fr; }
.call-grid[data-n="3"], .call-grid[data-n="4"] { grid-template-columns: 1fr 1fr; }
.call-grid[data-n="5"], .call-grid[data-n="6"] { grid-template-columns: 1fr 1fr 1fr; }
.call-tile { position: relative; background: #0d1626; border-radius: 12px; overflow: hidden; min-height: 0; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #0d1626; }
.call-tile[data-tile=me] video { transform: scaleX(-1); }
.call-name { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .55); padding: 2px 8px; border-radius: 6px; font-size: .8rem; }
.call-state { position: absolute; right: 8px; top: 8px; font-size: .76rem; background: rgba(0, 0, 0, .55); padding: 2px 8px; border-radius: 6px; }
.call-state:empty { display: none; }
.call-bar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.call-bar .danger { background: var(--error, #c0392b); color: #fff; border-color: var(--error, #c0392b); }
.call-note { margin: 0; text-align: center; min-height: 1em; }
@media (max-width: 760px) {
  .chat-app { grid-template-columns: 1fr; height: calc(100vh - 190px); }
  .chat-app .chat-main, .chat-app .chat-empty { display: none; }
  .chat-app.show-main .chat-side { display: none; }
  .chat-app.show-main .chat-main { display: flex; }
  .chat-list-btn { display: inline-flex; }
  .chat-msg { max-width: 94%; }
  .call-grid[data-n="2"], .call-grid[data-n="3"], .call-grid[data-n="4"], .call-grid[data-n="5"], .call-grid[data-n="6"] { grid-template-columns: 1fr 1fr; }
  dialog.chat-call { width: 100vw; height: 100dvh; border-radius: 0; }
}

/* Chat docked at the bottom of every screen (version 2.2.82): a fixed horizontal bar, and a resizable window above it */
:root { --dock-left: 210px; --dock-pad: 0px; --dock-w: 380px; --dock-h: 460px; }
.has-chat-dock main { padding-bottom: calc(var(--dock-pad) + 12px); }
.chat-dock { position: fixed; left: var(--dock-left); right: 104px; bottom: 0; z-index: 30; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; box-shadow: 0 -4px 18px rgba(0, 0, 0, .3); }
.chat-dock[hidden], .chat-dock-body[hidden] { display: none; }
.chat-dock-mini { display: flex; flex-direction: column; gap: 6px; padding: 8px 14px 6px; }
.chat-dock.open .chat-dock-mini { display: none; }
/* Version 2.3.32: Documentos shows the eight options; the rest stays apart, below */
.doc-more { margin-top: 18px; align-items: center; flex-wrap: wrap; }
#doc-cats-panel { margin-top: 22px; }
/* Version 2.3.30: Documentos, the preview on the right */
.wz-side { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 1.7fr); gap: 16px; align-items: start; margin-top: 14px; }
.wz-side[hidden] { display: none; }
.wz-frame { width: 100%; height: 780px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.wz-receipts { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 900px) { .wz-side { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 1100px) {
  #wz-host #tpl-active:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); column-gap: 16px; align-items: start; }
  #wz-host #tpl-active > * { grid-column: 1; }
  #wz-host #tpl-active > .output-head { grid-column: 1 / -1; }
  #wz-host #tpl-active > #tpl-preview { grid-column: 2; grid-row: 2 / span 30; overflow-x: auto; min-width: 0; }
  #wz-host iframe.html-letter { width: 868px; zoom: .63; min-height: 1110px; } /* the letter sheet is 816 px wide plus its page margin: whole, not cut */
}
.chat-dock-hide { position: absolute; top: 6px; right: 8px; z-index: 1; }
.chat-dock.open .chat-dock-hide { display: none; }
.chat-mini-log { display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-height: 40px; font-size: .86rem; }
.chat-mini-log p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-mini-log p b { color: var(--brand-blue); }
.chat-mini-log p small { color: var(--text-muted); margin-left: 6px; }
.chat-mini-log .hint { margin: 0; }
.chat-mini-form { display: flex; gap: 6px; }
.chat-mini-form input { flex: 1; min-width: 0; }
.chat-dock-bar { display: flex; align-items: center; justify-content: center; gap: 8px; height: 34px; border: 0; border-radius: 0; background: transparent; color: var(--text); font-weight: 600; cursor: pointer; box-shadow: none; }
.chat-dock-bar:hover { background: var(--surface-muted); }
.chat-dock-body { position: fixed; right: 104px; bottom: var(--dock-pad); z-index: 31; width: min(var(--dock-w), calc(100vw - 24px)); height: min(var(--dock-h), calc(100vh - 100px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px 12px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .4); overflow: hidden; }
.chat-dock-grip { position: absolute; left: 0; top: 0; width: 28px; height: 28px; cursor: nwse-resize; touch-action: none; z-index: 2; background: linear-gradient(135deg, var(--brand-blue) 0 3px, transparent 3px 6px, var(--brand-blue) 6px 9px, transparent 9px); opacity: .7; border-radius: 12px 0 0 0; }
.chat-dock-grip:hover { opacity: 1; }
.chat-dock-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px 8px 34px; border-bottom: 1px solid var(--border); }
.chat-dock-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-app.chat-docked { display: flex; flex: 1; min-height: 0; height: auto; gap: 0; }
.chat-app.chat-docked > * { border: 0; border-radius: 0; flex: 1; min-width: 0; }
.chat-app.chat-docked .chat-main, .chat-app.chat-docked .chat-empty { display: none; }
.chat-app.chat-docked.show-main .chat-side { display: none; }
.chat-app.chat-docked.show-main .chat-main { display: flex; }
.chat-app.chat-docked .chat-list-btn { display: inline-flex; }
.chat-app.chat-docked .chat-head { padding: 6px 8px; }
.chat-app.chat-docked .chat-head-b .mini { padding: 4px 8px; }
.chat-app.chat-docked .chat-log { padding: 10px; }
.chat-app.chat-docked .chat-form { padding: 8px; }
.chat-app.chat-docked .chat-msg { max-width: 94%; }
@media (max-width: 760px) {
  :root { --dock-left: 0px; }
  .chat-dock { right: 96px; left: 8px; }
  .chat-dock-body { right: 8px; }
}
.chat-app.chat-docked .chat-head-t { display: none; }
.chat-app.chat-docked .chat-head { justify-content: space-between; }

/* Chat alerts: a new message, or an incoming video call (version 2.2.84) */
.chat-alert { position: fixed; right: 110px; bottom: calc(var(--dock-pad) + 14px); z-index: 45; width: min(330px, calc(100vw - 24px)); display: grid; gap: 6px; padding: 12px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--brand-blue); border-radius: 12px; box-shadow: 0 10px 32px rgba(0, 0, 0, .5); animation: chat-alert-in .25s ease-out; }
.chat-alert[hidden] { display: none; }
.chat-alert.call { border-color: var(--ok, #2e7d4f); box-shadow: 0 0 0 3px rgba(46, 125, 79, .35), 0 10px 32px rgba(0, 0, 0, .5); animation: chat-alert-in .25s ease-out, chat-ring 1.2s ease-in-out infinite; }
.chat-alert-t { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.chat-alert p { margin: 0; color: var(--text-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chat-alert button.primary { justify-self: end; }
@keyframes chat-alert-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes chat-ring { 0%, 100% { box-shadow: 0 0 0 3px rgba(46, 125, 79, .35), 0 10px 32px rgba(0, 0, 0, .5); } 50% { box-shadow: 0 0 0 8px rgba(46, 125, 79, .15), 0 10px 32px rgba(0, 0, 0, .5); } }
@media (max-width: 760px) { .chat-alert { right: 8px; left: 8px; width: auto; } }
/* Version 2.2.90: preview of an HTML letter (Solicitud link de expediente) */
iframe.html-letter { width: 100%; min-height: 640px; border: 1px solid var(--line, #3a4a66); border-radius: 8px; background: #e9ecf1; }

/* Timbre (version 2.2.96): big, centered, flashing until answered */
.chat-ring-alert { position: fixed; left: 50%; top: 14%; transform: translateX(-50%); z-index: 70; width: min(420px, calc(100vw - 24px)); display: grid; gap: 10px; padding: 18px 20px; text-align: center; background: var(--surface); color: var(--text); border: 2px solid #e0a100; border-radius: 14px; animation: chat-ring-flash 1s ease-in-out infinite; }
.chat-ring-alert[hidden] { display: none; }
.chat-ring-alert strong { font-size: 1.25rem; }
.chat-ring-alert p { margin: 0; font-size: 1.6rem; font-weight: 700; }
@keyframes chat-ring-flash { 0%, 100% { box-shadow: 0 0 0 4px rgba(224, 161, 0, .35), 0 12px 40px rgba(0, 0, 0, .55); } 50% { box-shadow: 0 0 0 14px rgba(224, 161, 0, .12), 0 12px 40px rgba(0, 0, 0, .55); } }
.row-actions .btn-group-pop, .agenda-item .toolbar .btn-group-pop { left: auto; right: 0; min-width: 9rem; }
.btn-group-pop button.danger { color: var(--danger, #b3261e); }
.table-scroll:has(.btn-group[open]) { overflow: visible; }
.panel:has(.table-scroll .btn-group[open]), .panel:has(.table-scroll .btn-group[open]) > * { overflow: visible; }
.panel:has(.table-scroll .btn-group[open]) { position: relative; z-index: 20; }

.chat-imgwrap { display: block; margin-top: 4px; }
.chat-img { display: block; max-width: min(320px, 100%); max-height: 300px; border-radius: 10px; object-fit: cover; background: var(--surface); }
.chat-dl { display: inline-block; margin-top: 2px; font-size: .75rem; color: var(--muted, inherit); text-decoration: none; }
.chat-thumb { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
#chat-app.dropping { outline: 3px dashed var(--accent, #3b6fd0); outline-offset: -6px; }

/* Timbre button sits next to Enviar (v2.2.100); only the bell on narrow screens and in the docked window */
.chat-ring-btn { flex: none; align-self: flex-end; }
.chat-app.chat-docked .chat-ring-t { display: none; }
@media (max-width: 600px) { .chat-ring-t { display: none; } }

/* Version 2.3.4 (user's choice, idea 1): the Atrás / Adelante buttons float as two round buttons in the side margins, at about 30% of the window height, always above the chat window, of the
   window. The screen or dialog keeps a reserved strip at each side (--nav-side), so the buttons never sit over what is being read.
   The bar itself has no height (sticky at 30% of the window height, above the HUD arrows and Mony at the right edge), so it takes no room in the flow. Pop-up lists, the sign-in card and the public pages keep a plain bar. */
:root { --nav-side: 52px; --nav-btn: 44px; }
@media (max-width: 560px) { :root { --nav-side: 40px; --nav-btn: 34px; } }
main .view, dialog:not(.chat-call) { padding-inline: var(--nav-side); }
.page-nav, dialog .dlg-nav { position: sticky; bottom: min(max(70vh, calc(var(--dock-pad) + var(--dock-h) + 56px)), calc(100vh - 130px)); z-index: 40; height: 0; margin: 0; padding: 0; background: none; box-shadow: none; display: block; }
.page-nav > button {
  position: absolute; bottom: calc(var(--nav-btn) / -2); width: var(--nav-btn); height: var(--nav-btn); min-height: 0; padding: 0; border-radius: 50%;
  font-size: 0; display: inline-flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.page-nav > button::before { font-size: calc(var(--nav-btn) * .6); line-height: 1; font-weight: 600; }
.page-nav > [data-action="go-back"], .page-nav > [data-dlg-nav="back"] { left: calc(var(--nav-side) * -1 + (var(--nav-side) - var(--nav-btn)) / 2); }
.page-nav > [data-action="go-forward"], .page-nav > [data-dlg-nav="forward"] { right: calc(var(--nav-side) * -1 + (var(--nav-side) - var(--nav-btn)) / 2); }
.page-nav > [data-action="go-back"]::before, .page-nav > [data-dlg-nav="back"]::before { content: "‹"; }
.page-nav > [data-action="go-forward"]::before, .page-nav > [data-dlg-nav="forward"]::before { content: "›"; }
.pop-nav, .auth-nav, .public-nav, .mony-zoom .page-nav { position: static; height: auto; display: flex; z-index: auto; padding: 8px 0; }
.pop-nav > button, .auth-nav > button, .public-nav > button, .mony-zoom .page-nav > button { position: static; width: auto; height: auto; min-height: 36px; padding: 6px 14px; border-radius: 999px; font-size: .85rem; box-shadow: none; }
.pop-nav > button::before, .auth-nav > button::before, .public-nav > button::before, .mony-zoom .page-nav > button::before { content: none; }

/* Version 2.3.12: in «Firmar y enviar por correo», the letter's template (preview) on the right and its fields on the left, to see the result step by step. */
@media (min-width: 1000px) {
  #fse-dialog { width: min(1400px, calc(100vw - 32px)); }
  #fse-carta:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; align-items: start; }
  #fse-carta > * { grid-column: 1; min-width: 0; }
  #fse-carta > #fse-carta-view { grid-column: 2; grid-row: 1 / span 30; position: sticky; top: 0; height: 80vh !important; }
}

/* Version 2.3.14: «Solo el PDF que subo»: the fields on the left and the PDF preview (where the signature goes) fixed on the right, to follow the data live. */
@media (min-width: 1000px) {
  #fse-dialog form.fse-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; align-items: start; }
  #fse-dialog form.fse-side > * { grid-column: 1; min-width: 0; }
  #fse-dialog form.fse-side > h3, #fse-dialog form.fse-side > h3 + p.hint { grid-column: 1 / -1; }
  #fse-dialog form.fse-side > #fse-view { grid-column: 2; grid-row: 3 / span 40; position: sticky; top: 0; max-height: 82vh; }
}

/* Consulta de procesos: la insignia «N nueva(s)» abre las actuaciones del expediente. */
button.badge-link { font: inherit; cursor: pointer; }
button.badge-link:hover, button.badge-link:focus-visible { text-decoration: underline; filter: brightness(.95); }
.last-act-note { display: inline-block; max-width: 34ch; white-space: normal; }

/* v2.3.45: case screen section menu (side menu on PC, selector on phones) */
.ficha-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 4px; }
.ficha-main { min-width: 0; }
.sec-side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 8px); display: grid; gap: 2px; max-height: calc(100vh - 16px); overflow: auto; padding: 4px 0; }
.sec-group { display: grid; gap: 3px; }
.sec-group small { margin: 10px 0 2px 4px; font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sec-group:first-child small { margin-top: 0; }
.sec-side .sec-group button { text-align: left; width: 100%; justify-content: flex-start; }
.sec-select { display: none; }
@media (max-width: 760px) {
  .ficha-layout { grid-template-columns: 1fr; gap: 8px; }
  .sec-side { position: static; max-height: none; overflow: visible; padding: 0; }
  .sec-side .sec-group { display: none; }
  .sec-select { display: grid; gap: 4px; font-size: .75rem; color: var(--muted); }
  .sec-select select { width: 100%; }
}

/* Reconsultar (2.3.50): result of consulting one process with an error, inside its row */
.recheck-out { margin-top: 4px; font-size: .85em; overflow-wrap: anywhere; }
.recheck-out.bad { color: var(--error); font-weight: 600; }
/* Correo con trazabilidad: el correo y las fechas largas bajan de renglón en vez de ensanchar la tabla. */
#mail-rows td:first-child { overflow-wrap: anywhere; }
#mail-rows .nowrap { white-space: normal; }
#mail-rows .row-actions { text-align: left; }

/* 2.3.70 (option C, John): the action button shows what the App is doing (spinner + «Consultando… 7/12», locked) and a line under it
   says the step and what follows; when it ends, «✓ … hace un momento · … de nuevo» and the line in green («Terminado: …»).
   Brand colors written as values (the HUD theme repaints the tokens): navy #002b6a, blue #027cc6, silver #989795 / #c4c8cb, white.
   The spinner turns while Pantalla → «Efectos» is on (<html data-fx="on">), whatever the device's reduced-motion setting; with Efectos off it stays still. */
:root button.step-busy, :root button.step-busy:disabled, :root button.step-busy:hover {
  opacity: 1; cursor: progress; background: #027cc6; border: 1px solid #027cc6; color: #fff; box-shadow: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transform: none;
}
:root button.step-busy .step-count { font-weight: 400; font-variant-numeric: tabular-nums; }
.step-spin {
  flex: none; width: 1em; height: 1em; border-radius: 50%; box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
}
:root[data-fx="on"] .step-spin { animation: step-spin .8s linear infinite; }
@keyframes step-spin { to { transform: rotate(360deg); } }
:root button.step-done, :root button.step-done:disabled {
  background: #fff; color: #002b6a; border: 1.5px solid #027cc6; box-shadow: none; font-weight: 600; opacity: 1;
  white-space: normal; text-align: center; line-height: 1.3;
}
:root button.step-done:hover:not(:disabled) { background: #eef6fc; color: #002b6a; border-color: #002b6a; }
.step-line, :root #consulta-status.step-line {
  margin: 6px 0 10px; padding: 8px 12px; border-radius: 8px; background: #fff; border: 1px solid #c4c8cb; box-shadow: none;
  font-family: "Century Gothic", Arial, sans-serif; font-size: .88rem; font-weight: 400; line-height: 1.45;
  color: #4a4a49; overflow-wrap: anywhere;
}
.step-line strong { color: #002b6a; }
.step-line.is-done strong { color: #1e7a46; }
.step-line.is-failed { border-color: #c0392b; }
.step-line.is-failed strong { color: #b3261e; }
.step-line .step-detail { display: block; margin-top: 4px; white-space: pre-line; color: #4a4a49; }
.step-line[data-dialog-step] { margin: 8px 0 0; }
#draft-step { margin-top: 8px; }
@media (max-width: 760px) {
  .view-head .toolbar button.step-busy, .view-head .toolbar button.step-done { flex: 1 1 100%; }
}
/* 2.3.79 (John): the percentage of each activity («Generando documento… 65 %») and a thin brand bar (role="progressbar"):
   at the foot of the busy button, or under the line's text when there is no button. Track silver #c4c8cb, fill navy #002b6a → blue #027cc6.
   The width changes with a short transition only while Pantalla → «Efectos» is on (data-fx), like the spinner. */
:root button.step-busy { position: relative; overflow: hidden; padding-bottom: 9px; flex-wrap: wrap; row-gap: 2px; white-space: normal; text-align: center; max-width: 100%; }
:root button.step-busy .step-pct { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.step-bar { display: block; height: 4px; border-radius: 4px; background: #c4c8cb; overflow: hidden; }
.step-bar > span { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #002b6a, #027cc6); }
:root[data-fx="on"] .step-bar > span { transition: width .35s ease-out; }
:root button.step-busy > .step-bar { position: absolute; left: 6px; right: 6px; bottom: 3px; height: 4px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .6); }
.step-line > .step-bar { margin-top: 6px; }
.step-line .step-pct-line { display: inline-block; min-width: 3.2em; font-weight: 700; color: #027cc6; font-variant-numeric: tabular-nums; }
.step-line.is-done .step-pct-line { color: #1e7a46; }
.step-float { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60; width: min(520px, calc(100vw - 32px));
  box-shadow: 0 6px 18px rgba(0, 43, 106, .18); }

/* 2.3.99: «No se podrá enviar el correo porque faltan datos:» */
.gaps-dialog { max-width: 520px; }
.gaps-dialog .form-error { font-weight: 600; }
.gaps-list { margin: 6px 0 12px; padding-left: 22px; }
.gaps-list li { margin: 4px 0; line-height: 1.35; }

/* Version 2.3.103: Editar / Eliminar of a fee sit under its concept on the client and case screens (Gerencia only). */
.fee-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; text-align: left; white-space: normal; }

/* Version 2.3.108: installments split by the App — a calculated box shows its share in gray with «calculada»; a typed one says «escrita». */
.inst-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: .75rem; font-weight: 600; vertical-align: middle; }
.inst-tag:empty { display: none; }
.inst-tag.is-auto { color: var(--text-muted); background: var(--surface-muted); border: 1px dashed var(--border); }
.inst-tag.is-typed { color: var(--brand-blue); background: color-mix(in srgb, var(--brand-blue) 10%, transparent); }
input[data-money][data-auto]::placeholder, #charge-parts input[data-pa]::placeholder { color: var(--text-muted); font-style: italic; opacity: 1; }
input.over { border-color: var(--error) !important; background: color-mix(in srgb, var(--error) 8%, var(--surface)) !important; }
/* 2.3.120: «Registrar honorarios»: 1. Cuota de separación, 2. Cuotas, and the summary Total · Separación · Saldo en cuotas. */
#charge-dialog .charge-box { margin: 4px 0 12px; padding: 8px 12px 4px; border-radius: 12px; }
#charge-dialog .charge-box legend { font-weight: 600; padding: 0 6px; }
#charge-dialog .charge-box > p.muted { margin: 0 0 6px; font-size: .85rem; }
#charge-dialog .charge-box.is-edit { border: 0; padding: 0; margin: 0; }
#charge-dialog .charge-summary { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 8px; }
#charge-dialog .charge-summary[hidden] { display: none; }
#charge-dialog .charge-summary span { padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--brand-blue) 10%, transparent); color: var(--text); font-size: .88rem; }
#charge-dialog .charge-summary b { color: var(--brand-blue); }
#charge-dialog .charge-summary .sum-problem { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--error); }
.warn-text, .inst-problem { color: var(--error); font-weight: 600; }
.inst-problem:empty { display: none; }
.inst-head { display: grid; gap: 4px; }
.inst-head p { margin: 0; }

/* Version 2.3.121 (John): a fee shows its balance (value − paid) first; value and paid stay under it, small. One money column, so the
   narrow Pagos panel and phones show it without cutting. */
.fee-bal { white-space: nowrap; }
.fee-bal strong { display: block; font-size: 1.05rem; color: var(--text); font-variant-numeric: tabular-nums; }
.fee-due { display: block; margin-top: 2px; font-size: .78rem; color: var(--text-muted); }
.fee-bal .fee-ref { display: block; font-size: .74rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chip-stat.fee-chip { flex: 1 1 auto; min-width: 0; }
.chip-stat.fee-chip strong { white-space: nowrap; overflow-wrap: normal; }
.chip-stat.chip-saldo strong { font-size: 1.12rem; }
.fee-table { width: 100%; }
.fee-table td.fee-bal { width: 1%; }
.fee-lbl { display: none; }
@media (max-width: 760px) { .fee-lbl { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); } } /* phones stack the table and hide its head */
/* 2.3.121: the Pagos tiles («Saldo por cobrar», …) showed «$ 2.100» for $ 2.100.000 (the HUD 2.4rem size overflowed the tile). */
.pay-kpis .kpi .kpi-value { font-size: clamp(1rem, 1.2vw, 1.5rem); white-space: nowrap; overflow-wrap: normal; }
@media (max-width: 760px) { .pay-kpis .kpi .kpi-value { font-size: 1.5rem; } }
/* 2.3.121: on phones the Pagos tables (cartera, cobros) are stacked cards: the buttons wrap and the amounts sit on the left, so the
   card is never wider than the screen (before, «$ 1.600.000» and «Registrar pago» were cut at the right edge). */
@media (max-width: 760px) {
  #pay-cartera .row-actions, #pay-charges .row-actions, #pay-receipts .row-actions { white-space: normal; }
  #pay-cartera .row-actions button, #pay-charges .row-actions button, #pay-receipts .row-actions button { margin: 2px 0; }
  #pay-cartera td.num, #pay-charges td.num, #pay-receipts td.num, .fee-table td.num { text-align: left; }
  .fee-table td.fee-bal { width: auto; }
}

/* ---------- Plazo de tareas: chip de calendario (version 2.3.122, John's choice «Idea 1», 11/11/2026) ----------
   Colour by urgency: vencida = --error of the theme; hoy/mañana amber; 2–3 días yellow; en plazo brand blue #027cc6; cumplida neutral. */
/* The case screen's task panel is about 680 px wide on a 1280 px PC: the Plazo column keeps 11rem (chip beside the text, the date
   may take two lines) and the Seguimiento badge may wrap, so «Acciones» stays visible; with room (wide screens) it takes 13.5rem. */
.due-col, td.due-cell { min-width: 11rem; }
@media (min-width: 1500px) { .due-col, td.due-cell { min-width: 13.5rem; } }
.task-scroll td .follow { white-space: normal; }
.due-chip { display: flex; gap: 8px; align-items: flex-start; }
.due-chip.u-late { --u: var(--error); --u-ink: #fff; }
.due-chip.u-today { --u: #ff9f43; --u-ink: #241000; --u-text: #b45309; }
.due-chip.u-soon { --u: #ffe066; --u-ink: #231d00; --u-text: #8a6d00; }
.due-chip.u-ok { --u: #027cc6; --u-ink: #fff; }
.due-chip.u-done { --u: var(--text-muted); --u-ink: var(--surface, #fff); }
.due-cal { flex: 0 0 auto; width: 56px; border-radius: 10px; overflow: hidden; text-align: center; line-height: 1.15;
  border: 1px solid var(--u); background: color-mix(in srgb, var(--u) 12%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--u) 30%, transparent); }
.due-cal .m { display: block; background: var(--u); color: var(--u-ink); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 1px 0; }
.due-cal .d { display: block; font-size: 1.55rem; font-weight: 700; line-height: 1.1; color: var(--heading, var(--text)); padding: 2px 0 3px; font-variant-numeric: tabular-nums; }
.due-cal .h { display: block; font-size: .64rem; color: var(--text); margin-top: -3px; padding-bottom: 3px; white-space: nowrap; }
.due-txt { display: grid; gap: 1px; min-width: 0; }
.due-txt .cd { font-weight: 700; font-size: .84rem; color: var(--u-text, var(--u)); }
.due-txt .wd { font-weight: 600; font-size: .82rem; }
.due-chip.u-done .due-cal { box-shadow: none; opacity: .75; }
.due-chip.u-done .due-cal .d { color: var(--text-muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .due-chip.u-today, :root:not([data-theme="light"]) .due-chip.u-soon { --u-text: var(--u); } :root:not([data-theme="light"]) .due-chip.u-ok { --u-text: #4fb0ee; } }
:root[data-theme="dark"] .due-chip.u-today, :root[data-theme="dark"] .due-chip.u-soon { --u-text: var(--u); }
:root[data-theme="dark"] .due-chip.u-ok { --u-text: #4fb0ee; }
@media (max-width: 760px) { .due-col, td.due-cell { min-width: 0; } td.due-cell { padding: 6px 0 !important; } .due-cal { width: 64px; } .due-chip { gap: 10px; } .due-txt .wd { font-size: .86rem; } }
