@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eff6ff;

  --success: #059669;
  --success-soft: #ecfdf5;

  --warning: #d97706;
  --warning-soft: #fffbeb;

  --danger: #dc2626;
  --danger-soft: #fef2f2;

  --neutral-950: #0f172a;
  --neutral-900: #111827;
  --neutral-800: #1f2937;
  --neutral-700: #334155;
  --neutral-600: #475569;
  --neutral-500: #64748b;
  --neutral-400: #94a3b8;
  --neutral-300: #cbd5e1;
  --neutral-200: #e2e8f0;
  --neutral-100: #f1f5f9;
  --neutral-50: #f8fafc;

  --bg-main: #f7f8fb;
  --bg-card: #ffffff;
  --bg-soft: #f9fafc;
  --bg-elevated: #ffffff;
  --bg-sidebar: #0b1220;
  --bg-inverse: #0f172a;
  --bg-accent: #eff6ff;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #f8fafc;

  --border-color: #e8edf3;
  --border-strong: #d4dce6;
  --border-soft: #f0f3f8;

  --surface-urgent: #fff7ed;
  --surface-danger: #fef2f2;
  --surface-info: #eff6ff;
  --surface-success: #ecfdf5;
  --surface-purple: #f5f3ff;
  --surface-indigo: #eef2ff;
  --surface-cyan: #ecfeff;
  --surface-yellow: #fefce8;
  --surface-pink: #fdf2f8;
  --surface-neutral: #f8fafc;

  --hero-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 52%, #0f766e 100%);

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;

  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 11px;
  --radius-sm: 9px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.07);

  --transition-fast: 0.16s ease;
}

:root[data-theme='dark'] {
  --primary: #60a5fa;
  --primary-strong: #93c5fd;
  --primary-soft: rgba(96, 165, 250, 0.14);

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);

  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);

  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --neutral-950: #f8fafc;
  --neutral-900: #e5edf7;
  --neutral-800: #dbe7f5;
  --neutral-700: #bfcee2;
  --neutral-600: #9eb1c8;
  --neutral-500: #7d91aa;
  --neutral-400: #64748b;
  --neutral-300: #334155;
  --neutral-200: #223041;
  --neutral-100: #182331;
  --neutral-50: #101926;

  --bg-main: #0b1220;
  --bg-card: #111b2b;
  --bg-soft: #0f1724;
  --bg-elevated: #162234;
  --bg-sidebar: #08111d;
  --bg-inverse: #08111d;
  --bg-accent: rgba(96, 165, 250, 0.14);

  --text-main: #e5edf7;
  --text-muted: #9eb1c8;
  --text-inverse: #f8fafc;

  --border-color: #223041;
  --border-strong: #334155;
  --border-soft: #1a2738;

  --surface-urgent: rgba(194, 65, 12, 0.18);
  --surface-danger: rgba(185, 28, 28, 0.18);
  --surface-info: rgba(37, 99, 235, 0.16);
  --surface-success: rgba(5, 150, 105, 0.16);
  --surface-purple: rgba(124, 58, 237, 0.18);
  --surface-indigo: rgba(67, 56, 202, 0.18);
  --surface-cyan: rgba(8, 145, 178, 0.18);
  --surface-yellow: rgba(161, 98, 7, 0.18);
  --surface-pink: rgba(190, 24, 93, 0.18);
  --surface-neutral: #162234;

  --hero-gradient: linear-gradient(135deg, #08111d 0%, #0f1b2d 52%, #0b5f61 100%);

  --shadow-xs: 0 1px 2px rgba(2, 6, 23, 0.45);
  --shadow-sm: 0 10px 24px rgba(2, 6, 23, 0.32);
  --shadow-md: 0 18px 40px rgba(2, 6, 23, 0.36);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body,
#root {
  width: 100%;
  min-height: 100%;
}

html {
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-family);
}

.app-layout,
.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.main-content,
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
}

.sidebar {
  width: 272px;
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, #111827 100%);
  color: rgba(241, 245, 249, 0.78);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(2, 6, 23, 0.18);
  z-index: 50;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 1.45rem 1.2rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sidebar-nav {
  padding: 0.95rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.72rem 0.82rem;
  border-radius: var(--radius-md);
  font-weight: 550;
  font-size: 0.9rem;
  color: rgba(241, 245, 249, 0.76);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-link:hover {
  background: rgba(148, 163, 184, 0.14);
  color: #f8fafc;
}

.sidebar-link.active {
  background: rgba(37, 99, 235, 0.2);
  color: #f8fafc !important;
  border: 1px solid rgba(96, 165, 250, 0.32);
}

.header {
  height: 72px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.content-area,
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.35rem 1.5rem 1.6rem;
  max-width: 1540px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.page-shell {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  min-width: 0;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.62rem;
  letter-spacing: -0.024em;
  line-height: 1.12;
  font-weight: 800;
  color: var(--neutral-950);
}

.page-subtitle {
  margin-top: 0.2rem;
  font-size: 0.9rem;
  color: var(--neutral-500);
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.card-compact {
  padding: 0.85rem;
}

.card-muted {
  background: var(--bg-soft);
}

.btn {
  padding: 0.58rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--neutral-700);
}

.btn:hover {
  background: var(--neutral-100);
}

.btn-primary {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn:disabled,
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn:disabled:hover,
.btn-primary:disabled:hover {
  background: var(--bg-card);
}
.btn-primary:disabled:hover {
  background: var(--primary);
}

.btn-soft {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border-color));
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.btn-díanger {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border-color));
  background: var(--bg-card);
  color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-primary {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-díanger {
  background: var(--danger-soft);
  color: var(--danger);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
}

.kpi-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 0.95rem 1rem;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
}

/* Contabilidad: interfaz financiera compacta y no técnica. */
.accounting-page { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 3rem; }
.accounting-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.accounting-head-actions { display: flex; align-items: center; gap: .6rem; }
.accounting-eyebrow { margin: 0 0 .25rem; color: var(--primary); font-size: .7rem; font-weight: 800; letter-spacing: .11em; }
.accounting-tabs { display: flex; gap: .25rem; padding: .3rem; overflow-x: auto; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-card); box-shadow: var(--shadow-xs); }
.accounting-tabs button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .4rem; border: 0; border-radius: 10px; padding: .58rem .72rem; background: transparent; color: var(--neutral-500); font-size: .76rem; font-weight: 700; }
.accounting-tabs button:hover { background: var(--bg-soft); color: var(--neutral-800); }
.accounting-tabs button.active { color: white; background: var(--neutral-900); }
.accounting-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.accounting-kpis > div { min-height: 118px; display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.05rem; border: 1px solid var(--border-color); border-radius: 16px; background: var(--bg-card); box-shadow: var(--shadow-xs); }
.accounting-kpis span { color: var(--neutral-500); font-size: .76rem; font-weight: 700; }
.accounting-kpis strong { font-size: 1.45rem; color: var(--neutral-950); letter-spacing: -.03em; }
.accounting-kpis small, .accounting-row small, .bank-card small, .asset-card small, td small { display: block; color: var(--neutral-500); font-size: .72rem; }
.accounting-kpis .positive strong, .green { color: var(--success) !important; }
.accounting-kpis .negative strong, .red { color: var(--danger) !important; }
.accounting-kpis.taxes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.accounting-grid { display: grid; gap: 1rem; }.accounting-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.accounting-page .card h2 { margin: 0 0 .25rem; color: var(--neutral-900); font-size: .98rem; }
.accounting-page .muted, .accounting-section-head p { margin: .15rem 0; color: var(--neutral-500); font-size: .8rem; }
.accounting-section-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .9rem; }
.accounting-row { display: flex; align-items: center; gap: .7rem; padding: .78rem 0; border-bottom: 1px solid var(--border-color); font-size: .8rem; }
.accounting-row:last-child { border-bottom: 0; }.accounting-row > div { flex: 1; }.row-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--primary); background: var(--primary-soft); }
.accounting-notice { display: flex; align-items: flex-start; gap: .55rem; padding: .75rem .85rem; border: 1px solid #bfdbfe; border-radius: 11px; background: #eff6ff; color: #1e40af; font-size: .78rem; line-height: 1.45; }
.accounting-notice.danger { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.tax-hero { display: flex; flex-direction: column; padding: 1.15rem 0; }.tax-hero span { color: var(--neutral-500); font-size: .75rem; }.tax-hero strong { font-size: 1.8rem; letter-spacing: -.04em; }.tax-hero small { color: var(--neutral-500); }
.accounting-empty { display: grid; place-items: center; min-height: 130px; color: var(--neutral-400); text-align: center; }.accounting-empty p { max-width: 410px; margin: .5rem 0; font-size: .8rem; }
.accounting-form { display: grid; gap: .6rem; }.accounting-form.compact { grid-template-columns: 135px minmax(180px, 1fr) minmax(170px, 1fr) minmax(170px, 1fr) 110px auto; margin-bottom: 1rem; }
.accounting-form input, .accounting-form select, .accounting-section-head select { min-height: 38px; width: 100%; padding: .52rem .65rem; border: 1px solid var(--border-color); border-radius: 9px; background: var(--bg-card); color: var(--neutral-800); font-size: .78rem; }
.accounting-table-wrap { width: 100%; overflow-x: auto; }.accounting-table { width: 100%; border-collapse: collapse; font-size: .76rem; }.accounting-table th { padding: .62rem .68rem; border-bottom: 1px solid var(--border-color); color: var(--neutral-500); text-align: left; font-size: .67rem; letter-spacing: .04em; text-transform: uppercase; }.accounting-table td { padding: .66rem .68rem; border-bottom: 1px solid var(--border-color); color: var(--neutral-700); }.accounting-table tbody tr:hover { background: var(--bg-soft); }.accounting-table .num { text-align: right; white-space: nowrap; }.accounting-table tfoot td { color: var(--neutral-900); font-weight: 800; background: #f0fdf4; }
.balance-line, .report-total { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .62rem 0; border-bottom: 1px solid var(--border-color); font-size: .78rem; }.report-total.grand { margin-top: .5rem; padding: .9rem; border: 0; border-radius: 10px; background: var(--neutral-900); color: #fff; }.report-total.grand b { font-size: 1.15rem; }
.period-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }.period-grid button { display: flex; align-items: center; justify-content: center; gap: .25rem; padding: .45rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); font-size: .68rem; }.period-grid button.closed { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.check-line { display: flex; align-items: center; gap: .65rem; padding: .65rem 0; border-bottom: 1px solid var(--border-color); font-size: .8rem; }.check-line span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--neutral-500); background: var(--bg-soft); font-size: .68rem; font-weight: 800; }.check-line span.done { color: #fff; background: #16a34a; }
.bank-card, .asset-card { display: flex; align-items: center; gap: .7rem; padding: .8rem; margin: .55rem 0; border: 1px solid var(--border-color); border-radius: 11px; }.bank-card > div, .asset-card > div:first-child { flex: 1; }.asset-card > div:last-child { display: flex; align-items: flex-end; flex-direction: column; gap: .35rem; }.file-drop { display: grid; place-items: center; gap: .3rem; padding: 1.4rem; border: 1px dashed #93c5fd; border-radius: 12px; color: #1d4ed8; background: #eff6ff; text-align: center; cursor: pointer; }.file-drop span { color: #64748b; font-size: .72rem; }.file-drop input { display: none; }
.praxis-card { display: flex; align-items: flex-start; gap: 1rem; max-width: 780px; }.praxis-card p:not(.accounting-eyebrow) { color: var(--neutral-500); font-size: .83rem; line-height: 1.5; }.praxis-icon { display: grid; place-items: center; flex: 0 0 58px; height: 58px; border-radius: 15px; color: #047857; background: #ecfdf5; }
.accounting-chart-layout { grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr) !important; align-items: start; }.account-create-card { position: sticky; top: 1rem; }.account-create-card label { display: grid; gap: .3rem; color: var(--neutral-700); font-size: .73rem; font-weight: 700; }.account-create-card label small { color: var(--neutral-500); font-weight: 400; line-height: 1.35; }.subaccount-example { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .25rem .5rem; margin: .9rem 0 1rem; padding: .75rem; border-radius: 10px; background: var(--bg-soft); font-size: .72rem; }.subaccount-example b { grid-column: 1 / -1; color: var(--neutral-500); font-size: .63rem; text-transform: uppercase; }.subaccount-example svg { display: none; }.subaccount-example strong { color: var(--primary-strong); }.account-name-input { width: 100%; min-width: 170px; padding: .42rem .5rem; border: 1px solid var(--primary); border-radius: 7px; background: var(--bg-card); }.account-actions { width: 72px; text-align: right; white-space: nowrap; }.icon-action { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: .2rem; border: 1px solid var(--border-color); border-radius: 8px; color: var(--neutral-600); background: var(--bg-card); }.icon-action:hover { color: var(--primary); border-color: var(--primary); }.icon-action.success { color: var(--success); }
.accounting-loading { min-height: 50vh; display: flex; align-items: center; justify-content: center; gap: .6rem; color: var(--neutral-500); }.accounting-busy { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 200; display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; border-radius: 999px; color: #fff; background: var(--neutral-900); box-shadow: var(--shadow-lg); font-size: .78rem; font-weight: 700; }
@media (max-width: 1050px) { .accounting-kpis { grid-template-columns: repeat(2, 1fr); }.accounting-form.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }.accounting-chart-layout { grid-template-columns: 1fr !important; }.account-create-card { position: static; } }
@media (max-width: 700px) { .accounting-head { align-items: flex-start; flex-direction: column; }.accounting-grid.two, .accounting-kpis, .accounting-kpis.taxes { grid-template-columns: 1fr; }.accounting-form.compact { grid-template-columns: 1fr; }.accounting-tabs { margin-inline: -.35rem; }.period-grid { grid-template-columns: repeat(3, 1fr); } }

.kpi-label {
  font-size: 0.72rem;
  color: var(--neutral-500);
}

.kpi-value {
  margin-top: 0.1rem;
  font-size: 1.34rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--neutral-950);
}

/*  Alert inline  */
.alert-inline {
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert-inline-success {
  background: var(--surface-success);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 25%, var(--border-color));
}

.alert-inline-díanger {
  background: var(--surface-danger);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--border-color));
}

.alert-inline-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 25%, var(--border-color));
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--neutral-600);
}

.form-input {
  width: 100%;
  padding: 0.62rem 0.72rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-family: var(--font-family);
  font-size: 0.86rem;
  color: var(--neutral-900);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
  color: var(--neutral-400);
}

.quick-capture-form { display:flex; flex-direction:column; gap:.65rem; }
.quick-capture-shortcuts { display:flex; flex-wrap:wrap; gap:.35rem; }
.quick-capture-voice { display:flex; width:100%; min-height:58px; align-items:center; gap:.65rem; margin-bottom:.55rem; padding:.62rem .72rem; border:1px solid #c4b5fd; border-radius:12px; background:linear-gradient(135deg,#f5f3ff,#fff); color:#5b21b6; font:inherit; text-align:left; cursor:pointer; }
.quick-capture-voice-icon { display:grid; flex:0 0 auto; width:36px; height:36px; place-items:center; border-radius:10px; background:#ede9fe; }
.quick-capture-voice > span:last-child { display:grid; min-width:0; gap:.08rem; }
.quick-capture-voice strong { font-size:.82rem; }
.quick-capture-voice small { color:#7c3aed; font-size:.68rem; }
.quick-capture-voice.is-recording { border-color:#ef4444; background:#fef2f2; color:#b91c1c; }
.quick-capture-voice:disabled { cursor:wait; opacity:.72; }
.quick-capture-voice.is-recording .quick-capture-voice-icon { background:#fee2e2; }
.quick-capture-voice.is-recording small { color:#dc2626; }
.quick-capture-listening { display:flex; min-width:0; align-items:center; gap:.4rem; margin:-.2rem 0 .45rem; overflow:hidden; color:#b91c1c; font-size:.7rem; font-weight:700; text-overflow:ellipsis; white-space:nowrap; }
.quick-capture-listening > span { width:8px; height:8px; flex:0 0 auto; border-radius:50%; background:#ef4444; box-shadow:0 0 0 4px #fee2e2; animation:quickCapturePulse 1.2s ease-in-out infinite; }
.quick-capture-dictation-error { margin:0 0 .45rem; padding:.5rem .6rem; border:1px solid #fecaca; border-radius:9px; background:#fef2f2; color:#b91c1c; font-size:.7rem; line-height:1.35; }
.quick-capture-voice-message { margin:0 0 .45rem; padding:.5rem .6rem; border:1px solid #bbf7d0; border-radius:9px; background:#f0fdf4; color:#15803d; font-size:.7rem; font-weight:700; line-height:1.35; }
.quick-capture-submit { align-self:flex-end; display:inline-flex; align-items:center; gap:.4rem; }
@keyframes quickCapturePulse { 50% { opacity:.35; transform:scale(.8); } }

textarea.form-input {
  min-height: 100px;
  line-height: 1.45;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}

/* ── Popups nativos (calendario de fechas, lista de <select>) ──
   El navegador solo permite tematizarlos parcialmente: accent-color pinta el
   día seleccionado del calendario y los resaltados nativos con el azul de la
   marca; color-scheme evita mezclas claro/oscuro; y las <option> se normalizan
   para que NO hereden colores de estado del propio select (p.ej. el ámbar de
   "Sin asignar" teñía todas las opciones de la lista). */
:root { accent-color: var(--primary); }
input, select, textarea { color-scheme: light; }
:root[data-theme='dark'] input,
:root[data-theme='dark'] select,
:root[data-theme='dark'] textarea { color-scheme: dark; }

select option {
  color: var(--neutral-900);
  background: var(--bg-card);
  font-weight: 500;
}

/* Icono del calendario en inputs de fecha/hora: sutil y clicable */
input[type='date']::-webkit-calendar-picker-indicator,
input[type='time']::-webkit-calendar-picker-indicator,
input[type='datetime-local']::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity var(--transition-fast);
}
input[type='date']::-webkit-calendar-picker-indicator:hover,
input[type='time']::-webkit-calendar-picker-indicator:hover,
input[type='datetime-local']::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

table th {
  background: var(--bg-soft);
  color: var(--neutral-400);
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border-soft);
}

table td {
  border-top: 1px solid var(--border-soft);
  color: var(--text-main);
}

.table-row-hover:hover {
  background: var(--bg-soft) !important;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--neutral-950);
}

.section-subtitle {
  margin-top: 0.12rem;
  font-size: 0.79rem;
  color: var(--neutral-500);
}

.split-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

.split-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.case-meta {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.case-meta-item {
  font-size: 0.78rem;
  color: var(--neutral-500);
  background: var(--neutral-50);
  border: 1px solid var(--neutral-100);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}

.tabs-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.36rem;
}

.tab-btn {
  padding: 0.38rem 0.68rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--neutral-600);
  font-size: 0.76rem;
  font-weight: 700;
}

.tab-btn.active {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 0.42rem;
}

.quick-action-btn {
  width: 100%;
  justify-content: flex-start;
  font-size: 0.78rem;
  padding: 0.42rem 0.55rem;
}

.list-scroll {
  max-height: 540px;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.helper-text {
  font-size: 0.76rem;
  color: var(--neutral-500);
}

.theme-surface {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

.theme-surface-soft {
  background: var(--bg-soft) !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

.theme-surface-elevated {
  background: var(--bg-elevated) !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

.theme-hero {
  background: var(--hero-gradient) !important;
  color: var(--text-inverse) !important;
  border: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent) !important;
  box-shadow: var(--shadow-md) !important;
}

.theme-hero-subtle {
  color: color-mix(in srgb, var(--text-inverse) 78%, transparent) !important;
}

.theme-card-button {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  box-shadow: var(--shadow-xs) !important;
}

.theme-card-button:hover {
  background: var(--bg-soft) !important;
}

.theme-pill-neutral {
  background: var(--surface-neutral) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
}

.theme-popover {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-md) !important;
}

.theme-table-row {
  background: var(--bg-card) !important;
}

.responsive-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.stack-on-mobile {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  flex-wrap: wrap;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.responsive-two-col {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
}

.responsive-split-main {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.responsive-three-col {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.responsive-video-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr);
  align-items: start;
}

.responsive-company-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(180px, 1.4fr) minmax(120px, 0.8fr) auto auto;
  align-items: end;
}

.responsive-main-with-aside {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 2.2fr) minmax(280px, 0.95fr);
  align-items: start;
}

.responsive-dashboard-hero {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.responsive-dashboard-kpis {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  flex: 2 1 450px;
}

.responsive-summary-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.responsive-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.55rem;
}

.responsive-entry-actions {
  display: grid;
  gap: 0.85rem;
}

.responsive-filter-card {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
}

.responsive-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.responsive-pill-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.responsive-pill-card {
  min-width: 180px;
}

/* Metrics workspace: executive overview first, details on demand. */
.metrics-page {
  display: grid;
  gap: 1rem;
  padding-bottom: 3rem;
}

.metrics-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 122px;
  padding: 1.25rem 1.4rem;
  border: 1px solid rgba(14, 116, 144, 0.18);
  border-radius: 20px;
  background:
    radial-gradient(circle at 88% 12%, rgba(45, 212, 191, 0.2), transparent 28%),
    linear-gradient(125deg, #103b52 0%, #0f5e63 100%);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
}

.metrics-hero::after {
  position: absolute;
  top: -80px;
  right: 17%;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  content: '';
}

.metrics-hero > * { position: relative; z-index: 1; }
.metrics-hero .page-title { margin-top: 0.2rem; color: #fff; font-size: clamp(1.55rem, 2.3vw, 2rem); }
.metrics-hero .page-subtitle { color: rgba(255, 255, 255, 0.7); }

.metrics-eyebrow {
  color: #99f6e4;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metrics-scope-filter {
  display: grid;
  min-width: 230px;
  gap: 0.35rem;
}

.metrics-scope-filter > span:first-child {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.metrics-scope-control {
  position: relative;
  display: flex;
  align-items: center;
}

.metrics-scope-control > svg {
  position: absolute;
  left: 0.8rem;
  z-index: 1;
  color: #0f5e63;
  pointer-events: none;
}

.metrics-scope-filter .form-input {
  min-height: 42px;
  width: 100%;
  padding-left: 2.35rem;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.94);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.12);
}

.metrics-scope-filter .form-input:hover,
.metrics-scope-filter .form-input:focus {
  border-color: #5eead4;
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.18), 0 6px 16px rgba(15, 23, 42, 0.13);
}

.metrics-scope-filter > small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.66rem;
  line-height: 1.3;
}

.metrics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.7rem;
}

.metrics-kpi-card {
  position: relative;
  overflow: hidden;
  display: grid;
  min-height: 112px;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid color-mix(in srgb, var(--metric-tone) 16%, var(--border-color));
  border-radius: 16px;
  background: linear-gradient(150deg, var(--bg-card) 58%, var(--metric-bg));
  color: inherit;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(15, 23, 42, 0.045);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.metrics-kpi-card::after {
  position: absolute;
  right: -24px;
  bottom: -34px;
  width: 86px;
  height: 86px;
  border: 12px solid color-mix(in srgb, var(--metric-tone) 8%, transparent);
  border-radius: 50%;
  content: '';
}

.metrics-kpi-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--metric-tone) 35%, var(--border-color));
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.08);
}

.metrics-kpi-card:focus-visible { outline: 2px solid var(--metric-tone); outline-offset: 2px; }

.metrics-tabs {
  display: inline-flex;
  width: fit-content;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.045);
}

.metrics-tabs button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--neutral-500);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
}

.metrics-tabs button:hover { background: var(--bg-soft); color: var(--text-main); }
.metrics-tabs button.active { background: #0f5e63; color: #fff; box-shadow: 0 4px 10px rgba(15, 94, 99, 0.2); }

.metrics-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  align-items: start;
  gap: 1rem;
}

.metrics-panel {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border-color) 88%, #cbd5e1) !important;
  border-radius: 18px !important;
  box-shadow: 0 9px 26px rgba(15, 23, 42, 0.045);
}

.metrics-panel-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.metrics-panel-heading h2 { margin: 0; color: var(--text-main); font-size: 0.98rem; }
.metrics-panel-heading p { margin: 0.12rem 0 0; color: var(--neutral-500); font-size: 0.72rem; }

.metrics-panel-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
}

.metrics-panel-icon.is-blue { background: #e0f2fe; color: #0369a1; }

.metrics-workload-list { display: grid; gap: 0.32rem; }

.metrics-workload-row {
  display: grid;
  grid-template-columns: auto minmax(110px, 0.65fr) minmax(100px, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.metrics-workload-row:hover { background: var(--bg-soft); }

.metrics-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.66rem;
  font-weight: 850;
}

.metrics-workload-person { display: grid; min-width: 0; }
.metrics-workload-person strong { overflow: hidden; color: var(--text-main); font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.metrics-workload-person small { color: var(--neutral-500); font-size: 0.66rem; }

.metrics-workload-bar { overflow: hidden; height: 7px; border-radius: 999px; background: var(--bg-soft); }
.metrics-workload-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0ea5e9, #14b8a6); }
.metrics-workload-alert { color: #dc2626; font-size: 0.68rem; font-weight: 800; }
.metrics-workload-ok { color: #15803d; font-size: 0.68rem; font-weight: 750; }
.metrics-empty { padding: 1.5rem; color: var(--neutral-500); font-size: 0.78rem; text-align: center; }

.metrics-panel table tbody tr { transition: background 120ms ease; }
.metrics-panel table tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 30%, transparent); }
.metrics-panel table th { background: color-mix(in srgb, var(--bg-soft) 68%, #fff); }

.metrics-economic-panel {
  padding: 1rem !important;
  border-top: 3px solid #059669 !important;
  background: radial-gradient(circle at 96% 0%, rgba(5, 150, 105, 0.08), transparent 25%), var(--bg-card) !important;
}

.metrics-companies { border-top: 3px solid #0891b2 !important; }
.metrics-team-load { border-top: 3px solid #2563eb !important; }
.metrics-team-performance { border-top: 3px solid #7c3aed !important; }
.metrics-state-summary { border-top: 3px solid #0f5e63 !important; }

@media (max-width: 1180px) {
  .metrics-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .metrics-hero { align-items: stretch; flex-direction: column; }
  .metrics-scope-filter { width: 100%; min-width: 0; }
  .metrics-overview-grid { grid-template-columns: minmax(0, 1fr); }
  .metrics-tabs { display: grid; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .previo-review-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .metrics-hero { min-height: auto; padding: 1rem; border-radius: 16px; }
  .metrics-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics-kpi-card { min-height: 104px; padding: 0.8rem; }
  .metrics-tabs button { padding-inline: 0.35rem; font-size: 0.68rem; }
  .metrics-tabs button svg { display: none; }
  .metrics-panel-heading { grid-template-columns: auto minmax(0, 1fr); }
  .metrics-panel-heading .btn { grid-column: 1 / -1; }
  .metrics-workload-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .metrics-workload-bar { display: none; }
}

@media (max-width: 768px) {
  .stack-on-mobile {
    flex-direction: column;
  }
  
  .mobile-cards .table-view {
    display: none;
  }
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1rem;
  max-width: 90%;
  width: 100%;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-md);
}

.agenda-form-full {
  grid-column: 1 / -1;
}

.agenda-task-form .form-input {
  min-height: 40px;
}

.agenda-task-form textarea.form-input {
  min-height: 58px;
}

.agenda-modal-panel {
  color: #0f172a;
}

@media (max-width: 640px) {
  .modal-content {
    max-width: 95%;
    padding: 1rem;
    border-radius: var(--radius-lg);
  }

  .agenda-modal-overlay {
    align-items: flex-start !important;
    padding: 0.45rem !important;
  }

  .agenda-modal-panel {
    max-height: calc(100dvh - 0.9rem) !important;
    overflow-y: auto !important;
    border-radius: 14px !important;
    padding: 0.8rem !important;
  }

  .agenda-task-form {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.5rem !important;
  }

  .agenda-task-form > * {
    grid-column: 1 / -1 !important;
  }

  .agenda-form-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.42);
  backdrop-filter: blur(2px);
  z-index: 45;
}

@media (max-width: 1024px) {
  body.peritix-mobile-menu-open {
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  body.peritix-mobile-menu-open .app-content {
    overflow: hidden !important;
    pointer-events: none;
  }

  .sidebar.sidebar-invo {
    z-index: 110;
  }

  .sidebar-backdrop {
    z-index: 100;
  }

  .sidebar.sidebar-invo .sidebar-invo-nav {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .responsive-two-col,
  .responsive-split-main,
  .responsive-three-col,
  .responsive-video-grid,
  .responsive-company-row,
  .responsive-main-with-aside {
    grid-template-columns: minmax(0, 1fr);
  }

  .responsive-pill-card {
    min-width: 0;
    flex: 1 1 220px;
  }

  .responsive-week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    position: fixed;
    left: -272px;
    top: 0;
    bottom: 0;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
    visibility: hidden;
  }

  .sidebar.open {
    transform: translateX(272px);
    visibility: visible;
    transition: transform 0.25s ease;
  }

  .header {
    padding: 0 0.95rem;
    height: 66px;
  }

  .content-area {
    padding: 1rem 0.9rem 1.3rem;
  }

  .desktop-only {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .page-title {
    font-size: 1.25rem;
  }

  .page-subtitle {
    font-size: 0.8rem;
  }

  .page-head {
    align-items: stretch;
    gap: 0.5rem;
  }

  .content-area {
    padding: 0.75rem 0.65rem 1rem;
  }

  .card {
    padding: 0.65rem;
    border-radius: var(--radius-md);
  }

  .toolbar {
    width: 100%;
  }

  .toolbar > .btn,
  .toolbar > a.btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .responsive-pill-row {
    flex-direction: column;
  }

  .responsive-dashboard-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .responsive-dashboard-kpis,
  .responsive-summary-grid,
  .responsive-week-grid,
  .responsive-entry-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .responsive-filter-card {
    flex-direction: column;
    align-items: stretch;
  }

  .responsive-filter-card > * {
    width: 100%;
  }

  .responsive-table {
    min-width: 720px;
  }

  .responsive-pill-card {
    width: 100%;
  }

  .btn {
    padding: 0.5rem 0.65rem;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
  }

  .btn-primary {
    min-height: 42px;
  }

  .form-input {
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
  }

  .form-label {
    font-size: 0.7rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .kpi-card {
    padding: 0.55rem 0.6rem;
  }

  .kpi-value {
    font-size: 1.15rem;
  }

  .section-title {
    font-size: 0.85rem;
  }

  .section-subtitle {
    font-size: 0.72rem;
  }

  .badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
  }

  .tabs-strip {
    gap: 0.25rem;
  }

  .tab-btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.7rem;
  }

  .list-scroll {
    max-height: 320px;
  }

  .quick-actions-grid {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .quick-action-btn {
    font-size: 0.74rem;
    padding: 0.38rem 0.5rem;
  }

  .helper-text {
    font-size: 0.72rem;
  }

  .case-meta-item {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
  }

  table th {
    font-size: 0.62rem;
    padding: 0.6rem 0.7rem;
  }

  table td {
    padding: 0.65rem 0.7rem;
  }

  .dashboard-shell {
    gap: 0.65rem;
  }

  .dashboard-hero {
    padding: 0.85rem;
    gap: 0.65rem;
  }

  .dashboard-title {
    font-size: 1.15rem;
  }

  .dashboard-description {
    font-size: 0.82rem;
  }

  .dashboard-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .dashboard-metric {
    padding: 0.55rem;
    border-radius: var(--radius-sm);
  }

  .dashboard-metric-value {
    font-size: 1.05rem;
  }

  .dashboard-metric-label {
    font-size: 0.72rem;
  }

  .dashboard-metric-hint {
    font-size: 0.65rem;
  }

  .dashboard-panel {
    padding: 0.7rem;
  }

  .dashboard-task-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.45rem 0.55rem;
    gap: 0.4rem;
  }

  .dashboard-task-title {
    font-size: 0.78rem;
  }

  .dashboard-task-meta {
    font-size: 0.68rem;
  }

  .dashboard-task-actions {
    justify-content: flex-start;
  }

  .dashboard-capture-grid {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .dashboard-capture-extra {
    grid-template-columns: 1fr;
  }

  .dashboard-queue {
    padding: 0.65rem;
  }

  .dashboard-queue-item {
    padding: 0.45rem;
  }

  .dashboard-queue-ref {
    font-size: 0.72rem;
  }

  .dashboard-queue-sub {
    font-size: 0.68rem;
  }

  .dashboard-queue-next {
    font-size: 0.68rem;
  }

  .dashboard-pipeline-row {
    padding: 0.45rem 0.5rem;
  }

  .dashboard-pipeline-meta {
    font-size: 0.72rem;
    margin-bottom: 0.25rem;
  }

  .dashboard-empty {
    padding: 0.75rem;
    font-size: 0.74rem;
  }

  .dashboard-hero-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .dashboard-hero-stat {
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius-sm);
  }

  .dashboard-hero-stat-value {
    font-size: 1.1rem;
  }

  .dashboard-hero-stat-label {
    font-size: 0.65rem;
  }

  .dashboard-kicker {
    font-size: 0.62rem;
  }

  .dashboard-agenda-list {
    gap: 0.35rem;
  }

  .invo-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .invo-strip-item {
    padding: 0.55rem 0.65rem;
    border-right: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
  }

  .invo-strip-value {
    font-size: 1.1rem;
  }

  .invo-strip-label {
    font-size: 0.65rem;
  }

  .invo-grid-top {
    grid-template-columns: 1fr;
  }

  .invo-grid-bottom {
    grid-template-columns: 1fr;
  }

  .invo-chart-card {
    padding: 0.7rem;
  }

  .invo-card-title {
    font-size: 0.82rem;
  }

  .invo-card-amount {
    font-size: 1.2rem;
  }

  .invo-bars {
    min-height: 100px;
    gap: 0.35rem;
  }

  .invo-bar-track {
    height: 80px;
  }

  .invo-bar-fill {
    width: 18px;
  }

  .invo-bar-label {
    font-size: 0.58rem;
  }

  .invo-highlight-card {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .invo-highlight-card h3 {
    font-size: 1rem;
  }

  .invo-highlight-card p {
    font-size: 0.72rem;
  }

  .invo-highlight-btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.72rem;
  }

  .invo-highlight-pill {
    font-size: 0.55rem;
    padding: 0.1rem 0.4rem;
  }

  .invo-activity-item {
    padding: 0.45rem 0.55rem;
  }

  .invo-activity-ref {
    font-size: 0.68rem;
  }

  .invo-activity-text {
    font-size: 0.72rem;
  }

  .invo-activity-client {
    font-size: 0.65rem;
  }

  .invo-activity-time {
    font-size: 0.6rem;
  }

  .invo-agenda-item {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.45rem;
  }

  .invo-agenda-title {
    font-size: 0.74rem;
  }

  .invo-agenda-meta {
    font-size: 0.65rem;
  }

  .invo-capture-row {
    grid-template-columns: 1fr;
  }

  .kanban-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .kanban-board-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .kanban-column {
    min-height: auto;
  }

  .kanban-column-body {
    min-height: auto;
    padding: 0.55rem;
    gap: 0.45rem;
  }

  .exp-row-grid {
    grid-template-columns: 1fr;
    grid-template-areas: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
  }

  .exp-row-status {
    align-self: flex-start;
  }

  .exp-row-action {
    margin-top: 0.15rem;
  }

  .exp-row-grid:hover {
    transform: none;
  }

  .header-invo-search {
    width: 100%;
    min-width: 0;
    padding: 0.35rem 0.55rem;
  }

  .header-invo-search-input {
    font-size: 0.78rem;
  }

  .header-invo-icon-btn {
    width: 32px;
    height: 32px;
  }

  .header-invo-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.68rem;
  }

  .header-invo-user {
    padding: 0.15rem;
  }

  .header-invo-popover {
    width: min(92vw, 300px) !important;
    right: 0;
  }

  .sidebar-logo {
    padding: 1rem 0.85rem;
    font-size: 1.15rem;
  }

  .sidebar-nav {
    padding: 0.65rem 0.5rem;
    gap: 0.15rem;
  }

  .sidebar-link {
    padding: 0.58rem 0.65rem;
    font-size: 0.82rem;
    gap: 0.65rem;
  }

  .sidebar-brand-icon {
    width: 28px;
    height: 28px;
  }

  .sidebar-brand-title {
    font-size: 1rem;
  }

  .sidebar-brand-subtitle {
    font-size: 0.6rem;
  }

  .modal-content {
    max-width: 96%;
    padding: 0.85rem;
    border-radius: var(--radius-md);
  }

  .split-grid-2,
  .split-grid-3 {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .responsive-company-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .responsive-main-with-aside {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .responsive-two-col {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .responsive-three-col {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .responsive-video-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .responsive-week-grid {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .stack-on-mobile {
    flex-direction: column;
    gap: 0.5rem;
  }

  .mobile-cards .table-view {
    display: none;
  }

  textarea.form-input {
    min-height: 70px;
  }

  .theme-hero {
    padding: 0.85rem !important;
    border-radius: var(--radius-md) !important;
  }

  .theme-pill-neutral {
    padding: 0.45rem 0.6rem !important;
    border-radius: var(--radius-sm) !important;
  }

  .theme-pill-neutral .helper-text {
    font-size: 0.65rem;
  }

  .theme-pill-neutral div[style*="font-weight: 800"] {
    font-size: 0.78rem !important;
    margin-top: 0.1rem !important;
  }

  /*  Pill cards: full width, no min-width, compact  */
  .responsive-pill-row {
    flex-direction: column;
    gap: 0.35rem;
  }
  .responsive-pill-card {
    min-width: 0 !important;
    flex: none !important;
    width: 100% !important;
    padding: 0.4rem 0.55rem !important;
  }

  .page-shell {
    gap: 0.65rem;
  }

  .invo-dashboard {
    gap: 0.65rem;
  }

  .invo-dashboard-title {
    font-size: 1.15rem;
  }

  .invo-dashboard-subtitle {
    font-size: 0.75rem;
  }

  .invo-table {
    min-width: 480px;
  }

  .invo-empty {
    padding: 0.75rem;
    font-size: 0.72rem;
  }

  .invo-status {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
  }
}

@media (max-width: 1024px) {
  /* Filters panel hidden until toggled on tablet/mobile */
  .responsive-filter-card.filters-mobile-hidden {
    display: none !important;
  }
}

@media (min-width: 1025px) {
  .mobile-only {
    display: none !important;
  }
}

/* Dashboard redesign */
.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 1rem;
  border: 1px solid var(--border-color);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-soft) 100%);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem;
}

.dashboard-hero-main {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dashboard-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary-strong);
}

.dashboard-title {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--neutral-950);
}

.dashboard-description {
  max-width: 760px;
  color: var(--neutral-600);
  font-size: 0.92rem;
}

.dashboard-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-top: 0.2rem;
}

.dashboard-hero-side {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  justify-content: space-between;
}

.dashboard-hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.dashboard-hero-stat {
  border: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  border-radius: 12px;
  padding: 0.62rem 0.72rem;
}

.dashboard-hero-stat-label {
  font-size: 0.72rem;
  color: var(--neutral-500);
}

.dashboard-hero-stat-value {
  margin-top: 0.15rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--neutral-900);
}

.dashboard-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.dashboard-metric {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 0.72rem;
  text-align: left;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.dashboard-metric:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.dashboard-metric-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-metric-icon {
  color: var(--neutral-500);
}

.dashboard-metric-value {
  font-size: 1.2rem;
  line-height: 1;
  color: var(--neutral-950);
}

.dashboard-metric-label {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--neutral-800);
}

.dashboard-metric-hint {
  margin-top: 0.1rem;
  font-size: 0.72rem;
  color: var(--neutral-500);
}

.dashboard-metric-primary {
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border-color));
  background: var(--bg-card);
}

.dashboard-metric-warning {
  border-color: color-mix(in srgb, var(--warning) 22%, var(--border-color));
  background: var(--bg-card);
}

.dashboard-metric-neutral {
  border-color: var(--border-color);
}

.dashboard-metric-díanger {
  border-color: color-mix(in srgb, var(--danger) 22%, var(--border-color));
  background: var(--bg-card);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.dashboard-primary-column,
.dashboard-secondíary-column {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.dashboard-panel {
  padding: 0.95rem;
}

.dashboard-agenda-list {
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dashboard-empty {
  border: 1px díashed var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  font-size: 0.8rem;
  text-align: center;
  color: var(--neutral-500);
}

.dashboard-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.55rem;
  align-items: center;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 0.52rem 0.62rem;
}

.dashboard-task-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--neutral-900);
}

.dashboard-task-meta {
  font-size: 0.74rem;
  color: var(--neutral-500);
}

.dashboard-task-priority {
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.66rem;
  font-weight: 700;
}

.dashboard-task-actions {
  display: flex;
  gap: 0.26rem;
}

.dashboard-capture-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr 0.9fr 0.9fr auto;
  gap: 0.55rem;
  align-items: end;
}

.dashboard-capture-submit {
  min-width: 150px;
}

.dashboard-capture-extra {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.dashboard-queue {
  padding: 0.9rem;
}

.dashboard-queue-díanger {
  border-color: #fecaca;
}

.dashboard-queue-warning {
  border-color: #fde68a;
}

.dashboard-queue-success {
  border-color: #bbf7d0;
}

.dashboard-queue-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dashboard-queue-item {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.54rem;
  background: var(--bg-card);
}

.dashboard-queue-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.dashboard-queue-ref {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--neutral-900);
}

.dashboard-queue-priority {
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
}

.dashboard-queue-sub {
  margin-top: 0.22rem;
  font-size: 0.74rem;
  color: var(--neutral-600);
}

.dashboard-queue-next {
  margin-top: 0.22rem;
  font-size: 0.74rem;
  color: var(--neutral-500);
}

.dashboard-queue-actions {
  margin-top: 0.42rem;
  display: flex;
  gap: 0.3rem;
}

.dashboard-pipeline-list {
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dashboard-pipeline-row {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.5rem 0.56rem;
  background: var(--bg-card);
}

.dashboard-pipeline-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.55rem;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.dashboard-pipeline-state {
  color: var(--neutral-700);
  font-weight: 700;
}

.dashboard-pipeline-count {
  color: var(--neutral-900);
  font-weight: 800;
}

.dashboard-pipeline-track {
  height: 7px;
  border-radius: 999px;
  background: var(--neutral-100);
  overflow: hidden;
}

.dashboard-pipeline-fill {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-strong) 100%);
}

/* Sidebar optimization */
.sidebar {
  background: radíal-gradient(130% 90% at 0% 0%, #13254a 0%, #0f1930 48%, #0a1426 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.18);
}

.sidebar-logo {
  padding: 1.2rem 1rem 0.9rem;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.62rem;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(30, 64, 175, 0.35);
}

.sidebar-brand-title {
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 800;
  color: #f8fafc;
}

.sidebar-brand-subtitle {
  margin-top: 0.18rem;
  font-size: 0.68rem;
  color: rgba(226, 232, 240, 0.75);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-section-label {
  padding: 0.3rem 1rem 0.1rem;
  font-size: 0.68rem;
  color: rgba(148, 163, 184, 0.8);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 0.5rem 0.7rem 0.7rem;
  gap: 0.24rem;
}

.sidebar-link {
  position: relative;
  border: 1px solid transparent;
  color: rgba(226, 232, 240, 0.82);
}

.sidebar-link.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.34) 0%, rgba(37, 99, 235, 0.08) 100%);
  border-color: rgba(96, 165, 250, 0.48);
  color: #fff !important;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: #60a5fa;
}

.sidebar-logout-wrap {
  margin-top: auto;
  padding: 0.8rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.sidebar-logout-btn {
  width: 100%;
  justify-content: flex-start;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.35);
}

.sidebar-logout-btn:hover {
  background: rgba(148, 163, 184, 0.15);
}

@media (max-width: 1280px) {
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-secondíary-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }

  .dashboard-capture-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-capture-submit {
    width: 100%;
  }
}

@media (max-width: 1024px) {
  .dashboard-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-secondíary-column {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .dashboard-metrics-grid,
  .dashboard-capture-grid,
  .dashboard-capture-extra,
  .dashboard-hero-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-task-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-task-actions {
    justify-content: flex-start;
  }
}

/* =========================================================
   Invo-like visual adíaptation (dashboard + nav shell)
   ========================================================= */

body {
  background: var(--bg-main);
}

.main-content,
.app-main {
  background: var(--bg-main);
}

.content-area,
.app-content {
  max-width: 1480px;
  padding: 1.6rem 1.75rem 2rem;
}

/* Sidebar */
.sidebar.sidebar-invo {
  position: relative;
  width: 230px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-color);
  box-shadow: none;
  color: var(--text-muted);
  /* El sidebar hereda su altura (100vh) del flex padre (.app-shell); sin esto
     el contenido (logo + workspace + menú + cerrar sesión) simplemente se
     salía por abajo en menús largos (p.ej. gerencia con cabeceras de grupo),
     cortando "Cerrar sesión" fuera de la pantalla. */
  height: 100%;
  overflow: visible;
  transition: width 180ms ease;
}

.sidebar.sidebar-invo.is-collapsed { width: 72px; }
.sidebar-collapse-btn { position: absolute; top: 50%; right: -13px; z-index: 25; display: grid; width: 26px; height: 42px; place-items: center; flex-shrink: 0; transform: translateY(-50%); border: 1px solid var(--border-color); border-radius: 0 9px 9px 0; color: var(--neutral-500); background: var(--bg-card); box-shadow: none; }
.sidebar-collapse-btn:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 35%, var(--border-color)); }
.sidebar.is-collapsed .sidebar-invo-top { padding: 0 0.45rem; justify-content: center; gap: 0.15rem; }
.sidebar.is-collapsed .sidebar-collapsible-label,
.sidebar.is-collapsed .sidebar-workspace-block,
.sidebar.is-collapsed .sidebar-link-label,
.sidebar.is-collapsed .sidebar-invo-nav > div { display: none !important; }
.sidebar.is-collapsed .sidebar-invo-logo { width: 30px; height: 30px; }
.sidebar.is-collapsed .sidebar-invo-logo img { width: 30px !important; height: 30px !important; }
.sidebar.is-collapsed .sidebar-collapse-btn { right: -13px; }
.sidebar.is-collapsed .sidebar-invo-nav { padding: 0.8rem 0.55rem; align-items: center; }
.sidebar.is-collapsed .sidebar-invo-link { width: 44px; height: 42px; padding: 0; justify-content: center; gap: 0; font-size: 0; }
.sidebar.is-collapsed .sidebar-invo-link svg { flex-shrink: 0; }
.sidebar.is-collapsed .sidebar-invo-link.active::before { left: -0.55rem; }
.sidebar.is-collapsed .sidebar-invo-bottom { padding: 0.5rem 0.55rem; }
.sidebar.is-collapsed .sidebar-account-trigger { display: grid; grid-template-columns: 34px; width: 44px; height: 44px; margin: 0 auto; padding: 0; place-content: center; }

.sidebar-customize-trigger { width: 100%; min-height: 34px; padding: .3rem .45rem; border-radius: 8px; color: var(--neutral-400); font-size: .69rem; font-weight: 650; text-align: left; }
.sidebar-customize-trigger:hover,
.sidebar-customize-trigger.is-open { color: var(--neutral-600); background: var(--bg-soft); }
.sidebar-customize-trigger.is-open::before { display: none; }
.sidebar-tools-panel { position: fixed; z-index: 120; left: 218px; bottom: 56px; width: min(360px, calc(100vw - 245px)); max-height: min(620px, calc(100dvh - 95px)); display: flex; flex-direction: column; padding: 0.85rem; border: 1px solid var(--border-color); border-radius: 15px; background: var(--bg-card); box-shadow: 0 18px 50px rgba(15,23,42,.2); color: var(--text-main); }
.sidebar.is-collapsed .sidebar-tools-panel { left: 62px; }
.sidebar-tools-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.sidebar-tools-head > div { display: flex; align-items: center; gap: 0.4rem; }
.sidebar-tools-head button { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 7px; color: var(--neutral-500); }
.sidebar-tools-panel > p { margin: 0.35rem 0 0.7rem; color: var(--neutral-500); font-size: 0.72rem; line-height: 1.4; }
.sidebar-tools-list { min-height: 0; overflow-y: auto; display: grid; gap: 0.2rem; padding-right: 0.15rem; }
.sidebar-tool-row { display: grid; grid-template-columns: 20px 20px minmax(0,1fr); align-items: center; gap: .45rem; width: 100%; min-height: 40px; padding: .35rem .45rem; border: 1px solid transparent; border-radius: 9px; color: var(--text-muted); text-align: left; }
.sidebar-tool-row:hover { border-color: var(--border-color); background: var(--bg-soft); }
.sidebar-tool-row.is-selected { color: var(--text-main); }
.sidebar-tool-row:disabled { cursor: default; opacity: .78; }
.sidebar-tool-check { display: grid; width: 18px; height: 18px; place-items: center; border: 1px solid var(--neutral-300); border-radius: 4px; color: #fff; font-size: .7rem; font-weight: 900; background: var(--bg-card); }
.sidebar-tool-row.is-selected .sidebar-tool-check { border-color: var(--primary); background: var(--primary); }
.sidebar-tool-row > span:nth-of-type(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; font-weight: 700; }
.sidebar-customizer-recommended { padding-top: .65rem; }
.sidebar-customizer-recommended button { display: flex; align-items: center; gap: .35rem; color: var(--neutral-600); font-size: .72rem; font-weight: 750; }
.sidebar-customizer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .75rem -.85rem -.85rem; padding: .75rem .85rem; border-top: 1px solid var(--border-color); }
.sidebar-customizer-actions button { min-height: 38px; border: 1px solid var(--border-color); border-radius: 9px; color: var(--text-main); font-size: .75rem; font-weight: 800; background: var(--bg-card); }
.sidebar-customizer-actions button.primary { border-color: var(--primary); color: #fff; background: var(--primary); }

.sidebar-account-trigger { display: grid; grid-template-columns: 34px minmax(0,1fr) 18px; align-items: center; gap: .55rem; width: 100%; min-height: 46px; padding: .35rem .45rem; border: 1px solid transparent; border-radius: 10px; color: var(--text-main); text-align: left; }
.sidebar-account-trigger:hover,
.sidebar-account-trigger.active { border-color: var(--border-color); background: var(--bg-soft); }
.sidebar-account-avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); font-size: .72rem; font-weight: 900; }
.sidebar-account-copy { display: grid; min-width: 0; gap: .05rem; }
.sidebar-account-copy strong,
.sidebar-account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-copy strong { font-size: .75rem; }
.sidebar-account-copy small { color: var(--neutral-500); font-size: .64rem; }
.sidebar-account-chevron { color: var(--neutral-400); transition: transform 150ms ease; }
.sidebar-account-trigger.active .sidebar-account-chevron { transform: rotate(180deg); }
.sidebar-account-menu { position: fixed; z-index: 130; left: 12px; bottom: 58px; width: 206px; display: grid; gap: .25rem; padding: .55rem; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); box-shadow: 0 14px 38px rgba(15,23,42,.2); }
.sidebar.is-collapsed .sidebar-account-menu { left: 62px; }
.sidebar-account-menu > div { display: grid; min-width: 0; gap: .08rem; padding: .35rem .45rem .5rem; border-bottom: 1px solid var(--border-color); }
.sidebar-account-menu > div strong,
.sidebar-account-menu > div small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-menu > div strong { font-size: .75rem; }
.sidebar-account-menu > div small { color: var(--neutral-500); font-size: .65rem; }
.sidebar-account-menu > a,
.sidebar-account-menu > button { display: flex; align-items: center; gap: .5rem; min-height: 36px; padding: .35rem .45rem; border-radius: 8px; color: var(--text-muted); font-size: .73rem; font-weight: 700; text-align: left; }
.sidebar-account-menu > a:hover,
.sidebar-account-menu > button:hover { background: var(--bg-soft); color: var(--text-main); }
.sidebar-account-menu > button { color: #b42318; }

.dashboard-settings-backdrop { position: fixed; inset: 0; z-index: 220; display: grid; place-items: center; padding: 1rem; background: rgba(15,23,42,.48); backdrop-filter: blur(2px); }
.dashboard-settings-dialog { width: min(560px, 100%); max-height: min(720px, calc(100dvh - 2rem)); overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--border-color); border-radius: 18px; background: var(--bg-card); box-shadow: 0 24px 70px rgba(15,23,42,.28); }
.dashboard-settings-dialog > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.2rem 0.9rem; border-bottom: 1px solid var(--border-color); }
.dashboard-settings-dialog > header span { display: flex; align-items: center; gap: .35rem; color: var(--primary); font-size: .67rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.dashboard-settings-dialog > header h2 { margin: .2rem 0 .15rem; font-size: 1.12rem; }
.dashboard-settings-dialog > header p { color: var(--neutral-500); font-size: .75rem; }
.dashboard-settings-dialog > header > button { display: grid; width: 34px; height: 34px; place-items: center; flex-shrink: 0; border-radius: 9px; color: var(--neutral-500); background: var(--bg-soft); }
.dashboard-settings-list { min-height: 0; overflow-y: auto; display: grid; gap: .45rem; padding: .9rem 1.2rem; }
.dashboard-settings-list > button { display: grid; grid-template-columns: 34px minmax(0,1fr) 40px; align-items: center; gap: .65rem; padding: .72rem; border: 1px solid var(--border-color); border-radius: 12px; color: var(--neutral-500); background: var(--bg-soft); text-align: left; }
.dashboard-settings-list > button.is-visible { border-color: #bfdbfe; color: var(--primary); background: #f8fbff; }
.dashboard-setting-eye { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--bg-card); }
.dashboard-settings-list > button span:nth-child(2) { display: grid; min-width: 0; gap: .1rem; }
.dashboard-settings-list > button strong { color: var(--text-main); font-size: .8rem; }
.dashboard-settings-list > button small { color: var(--neutral-500); font-size: .67rem; }
.dashboard-settings-list > button i { width: 36px; height: 21px; padding: 3px; border-radius: 99px; background: var(--neutral-300); transition: background 150ms ease; }
.dashboard-settings-list > button i b { display: block; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.2); transition: transform 150ms ease; }
.dashboard-settings-list > button.is-visible i { background: var(--primary); }
.dashboard-settings-list > button.is-visible i b { transform: translateX(15px); }
.dashboard-settings-dialog > footer { display: flex; justify-content: space-between; gap: .6rem; padding: .85rem 1.2rem 1.1rem; border-top: 1px solid var(--border-color); }
.manager-main-grid:has(> :only-child),
.perito-workspace-grid:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 768px) {
  .sidebar.sidebar-invo.is-collapsed { width: min(86vw, 288px) !important; }
  .sidebar.is-collapsed .sidebar-collapsible-label,
  .sidebar.is-collapsed .sidebar-workspace-block,
  .sidebar.is-collapsed .sidebar-link-label { display: initial !important; }
  .sidebar.is-collapsed .sidebar-invo-top { padding: 0 0.9rem; justify-content: space-between; }
  .sidebar.is-collapsed .sidebar-invo-nav { padding: 0.6rem; align-items: stretch; }
  .sidebar.is-collapsed .sidebar-invo-nav > div { display: flex !important; }
  .sidebar.is-collapsed .sidebar-invo-link { width: 100%; height: auto; padding: 0.42rem 0.7rem; justify-content: flex-start; gap: 0.65rem; font-size: 0.82rem; }
  .sidebar.is-collapsed .sidebar-collapse-btn { display: none !important; }
  .sidebar-tools-panel,
  .sidebar.is-collapsed .sidebar-tools-panel { left: 0.75rem; right: 0.75rem; bottom: 0.75rem; width: auto; max-height: calc(100dvh - 1.5rem); }
  .sidebar.is-collapsed .sidebar-account-trigger { grid-template-columns: 34px minmax(0,1fr) 18px; width: 100%; height: auto; margin: 0; padding: .35rem .45rem; place-content: initial; }
  .sidebar-account-menu,
  .sidebar.is-collapsed .sidebar-account-menu { left: .75rem; right: .75rem; bottom: .75rem; width: auto; }
}

.sidebar-invo-top {
  height: 54px;
  flex-shrink: 0;
  padding: 0 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-invo-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-invo-logo {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-invo-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.sidebar-invo-nav {
  padding: 0.6rem 0.6rem 0.75rem;
  gap: 0.15rem;
  /* Compensado para que quepa todo sin scroll en la mayoría de pantallas
     (por eso los espaciados del menú van ajustados y no "de folleto"). El
     scroll se deja como red de seguridad: en pantallas muy bajas (portátiles
     pequeños, ventana redimensionada) el menú desliza en vez de cortar el
     logo de arriba o "Cerrar sesión" de abajo, que siempre quedan fijos. */
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-invo-link {
  position: relative;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.42rem 0.7rem;
  gap: 0.65rem;
}

.sidebar-invo-link:hover {
  background: var(--bg-soft);
  color: var(--text-main);
}

.sidebar-invo-link.active {
  background: var(--primary-soft);
  color: var(--primary-strong) !important;
  border-color: transparent;
  font-weight: 700;
}

.sidebar-invo-link.active::before {
  content: '';
  position: absolute;
  left: -0.65rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

:root[data-theme='dark'] .sidebar.sidebar-invo {
  background: var(--bg-sidebar);
}

:root[data-theme='dark'] .sidebar-invo-link.active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

:root[data-theme='dark'] .dashboard-hero,
:root[data-theme='dark'] .dashboard-task-row,
:root[data-theme='dark'] .dashboard-queue-item,
:root[data-theme='dark'] .dashboard-pipeline-row,
:root[data-theme='dark'] .card {
  box-shadow: var(--shadow-sm);
}

.sidebar-invo-bottom {
  flex-shrink: 0;
  padding: 0.5rem 0.6rem;
  border-top: 1px solid var(--border-color);
}

/* AGENDA HEADER */
.agenda-page-head {
  flex-direction: column;
  gap: 0;
}

.agenda-hero {
  overflow: hidden;
  padding: 0;
  border: 1px solid #c9d8ef;
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 0%, rgba(45, 212, 191, 0.14), transparent 30%),
    linear-gradient(120deg, #ffffff 0%, #f7fbff 58%, #eef7f6 100%);
  box-shadow: 0 16px 38px rgba(15, 56, 91, 0.08);
}

.agenda-head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  gap: 1.5rem;
  padding: 1.15rem 1.25rem 1rem;
}

.agenda-title-block {
  min-width: 0;
}

.agenda-title-block .page-title {
  margin: 0.22rem 0 0.12rem;
  font-size: clamp(1.55rem, 2.3vw, 2.1rem);
  letter-spacing: -0.04em;
}

.agenda-title-block p {
  margin: 0;
  color: var(--neutral-500);
  font-size: 0.82rem;
}

.agenda-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  color: #087f74;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.agenda-head-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.agenda-scope-filter {
  display: grid;
  gap: 0.28rem;
  width: min(340px, 36vw);
  min-width: 285px;
}

.agenda-scope-filter > span:first-child {
  color: #35516c;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.agenda-scope-control {
  position: relative;
  display: flex;
  align-items: center;
}

.agenda-scope-control > svg:first-child {
  position: absolute;
  left: 0.78rem;
  z-index: 1;
  color: #087f74;
  pointer-events: none;
}

.agenda-scope-control > svg:last-child {
  position: absolute;
  right: 0.72rem;
  color: #5f7388;
  pointer-events: none;
}

.agenda-scope-control select {
  width: 100%;
  height: 46px;
  padding: 0 2.2rem 0 2.45rem;
  appearance: none;
  border: 1px solid #a9c8ca;
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.94);
  color: #10263c;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 750;
  box-shadow: 0 5px 14px rgba(11, 94, 87, 0.08);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.agenda-scope-control select:hover {
  border-color: #38a89d;
  transform: translateY(-1px);
}

.agenda-scope-control select:focus-visible {
  border-color: #0f9689;
  box-shadow: 0 0 0 3px rgba(15, 150, 137, 0.16), 0 7px 18px rgba(11, 94, 87, 0.1);
}

.agenda-scope-filter small {
  color: #60758a;
  font-size: 0.68rem;
  line-height: 1.35;
}

.agenda-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.8rem;
  padding: 0.72rem 1.25rem;
  border-top: 1px solid rgba(169, 200, 202, 0.55);
  background: rgba(255, 255, 255, 0.7);
}

.agenda-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.agenda-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.agenda-period-label {
  font-size: 0.86rem;
  font-weight: 800;
  min-width: 165px;
  text-align: center;
  color: var(--text-main);
  text-transform: capitalize;
}

.agenda-view-tabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--border-color);
  border-radius: 11px;
  background: var(--bg-soft);
}

.agenda-primary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.agenda-scope-notice {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.85rem;
  border: 1px solid #b8deda;
  border-radius: 11px;
  background: #effcf9;
  color: #17645e;
  font-size: 0.76rem;
  font-weight: 600;
}

@media (max-width: 820px) {
  .agenda-head-top,
  .agenda-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .agenda-scope-filter {
    width: 100%;
    min-width: 0;
  }

  .agenda-head-actions,
  .agenda-primary-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .agenda-controls {
    justify-content: space-between;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .agenda-head-top {
    padding: 1rem;
  }

  .agenda-toolbar {
    padding: 0.7rem 1rem;
  }

  .agenda-controls {
    display: grid;
    gap: 0.65rem;
  }

  .agenda-nav,
  .agenda-view-tabs {
    justify-content: space-between;
    width: 100%;
  }

  .agenda-period-label {
    min-width: 0;
    flex: 1;
  }

  .agenda-view-tabs .btn {
    flex: 1 1 0 !important;
  }

  .agenda-primary-actions .btn {
    justify-content: center;
    width: 100%;
  }
}

/* MOBILE COLLAPSIBLE - desktop always open, mobile toggleable */
.mobile-collapsible-toggle {
  display: none;
}

.mobile-collapsible-body {
  display: block;
}

@media (max-width: 768px) {
  .mobile-collapsible-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    gap: 0.5rem;
  }

  .mobile-collapsible-toggle:hover {
    background: var(--bg-soft);
  }

  .mobile-collapsible-title {
    flex: 1;
    min-width: 0;
  }

  .mobile-collapsible-body {
    display: none;
  }

  .mobile-collapsible-body.is-open {
    display: block;
    padding-top: 0.35rem;
  }
}

/* PDF Viewer ✅ responsive */
.pdf-toolbar-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 0.1rem;
  flex-shrink: 0;
}

/* Desktop: search panel always visible */
.pdf-search-panel {
  display: flex;
}

/* Panel toggle button hidden on desktop */
.pdf-panel-toggle {
  display: none;
}

@media (max-width: 768px) {
  .pdf-viewer-overlay {
    padding: 0 !important;
  }
  .pdf-viewer-container {
    border-radius: 0 !important;
    height: 100svh !important;
  }
  .pdf-viewer-body {
    flex-direction: column !important;
  }

  /* Search panel: hidden by default, shown when toggled */
  .pdf-search-panel {
    display: none;
    width: 100% !important;
    min-width: 0 !important;
    max-height: 45vh;
    overflow-y: auto;
    border-left: none !important;
    border-top: 1px solid var(--border-color);
    flex-direction: column;
    flex-shrink: 0;
  }
  .pdf-search-panel.is-open {
    display: flex !important;
  }

  /* Show panel toggle button on mobile */
  .pdf-panel-toggle {
    display: inline-flex !important;
  }

  /* Compact toolbar on mobile */
  .pdf-toolbar {
    padding: 0.45rem 0.65rem !important;
    gap: 0.25rem !important;
  }
  .pdf-toolbar-title {
    font-size: 0.78rem !important;
  }
  .pdf-toolbar-btn {
    padding: 0.3rem 0.45rem !important;
    font-size: 0.78rem !important;
    min-width: 0 !important;
  }
  .pdf-zoom-label {
    display: none !important;
  }
  .pdf-total-pages {
    display: none !important;
  }
  .pdf-page-input {
    width: 38px !important;
  }
}

/* Expedientes page header */
.exp-head-left {
  min-width: 0;
  flex: 1 1 auto;
}

/* Expedientes: clean portfolio cockpit. */
.expedientes-page {
  gap: 1rem !important;
}

.expedientes-page .exp-page-head {
  padding: 0.25rem 0 0.1rem;
}

.expedientes-page .page-title {
  font-size: clamp(1.55rem, 2vw, 2rem);
  letter-spacing: -0.035em;
}

.exp-head-actions .btn {
  min-height: 40px;
  border-radius: 11px;
  font-weight: 700;
}

.exp-operations {
  overflow: hidden;
  padding: 0 !important;
  border: 1px solid color-mix(in srgb, #2563eb 12%, var(--border-color)) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 94% 0%, rgba(37, 99, 235, 0.055), transparent 25%),
    var(--bg-card) !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.exp-operations-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 0.9rem 0.2rem;
}

.exp-operations-heading > div {
  display: grid;
  gap: 0.12rem;
}

.exp-operations-heading span {
  color: var(--primary);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.exp-operations-heading strong {
  font-size: 1rem;
}

.exp-operations-heading small {
  color: var(--neutral-400);
  font-size: 0.72rem;
}

.exp-operations-grid {
  grid-template-columns: repeat(5, minmax(145px, 1fr)) !important;
  gap: 0.5rem !important;
  padding: 0.35rem 0.7rem 0.7rem;
}

.exp-operation-card {
  position: relative;
  min-height: 66px;
  overflow: hidden;
  padding: 0.58rem 0.62rem !important;
  border: 1px solid color-mix(in srgb, var(--exp-tone) 14%, var(--border-color)) !important;
  border-radius: 12px !important;
  background: linear-gradient(145deg, color-mix(in srgb, var(--exp-soft) 48%, var(--bg-card)), var(--bg-card) 72%) !important;
  box-shadow: none !important;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease !important;
}

.exp-operation-card:first-child,
.exp-operation-card:last-child { border-radius: 12px !important; }
.exp-operation-card:hover {
  z-index: 1;
  border-color: color-mix(in srgb, var(--exp-tone) 44%, var(--border-color)) !important;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--exp-tone) 10%, transparent) !important;
  transform: translateY(-2px);
}
.exp-operation-card.is-active {
  z-index: 1;
  border-radius: 12px !important;
  border-color: var(--exp-tone) !important;
  background: linear-gradient(145deg, color-mix(in srgb, var(--exp-soft) 90%, var(--bg-card)), var(--bg-card)) !important;
  box-shadow: inset 0 0 0 1px var(--exp-tone), 0 8px 18px color-mix(in srgb, var(--exp-tone) 13%, transparent) !important;
}

.exp-operation-card.is-empty { opacity: 0.72; }
.exp-operation-card.is-empty:hover,
.exp-operation-card.is-empty.is-active { opacity: 1; }

.exp-operation-copy {
  display: grid;
  min-width: 0;
  gap: 0.08rem;
}

.exp-operation-label {
  overflow: hidden;
  color: var(--neutral-600) !important;
  font-size: 0.7rem !important;
  font-weight: 750 !important;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-operation-count {
  color: var(--exp-tone) !important;
  font-size: 1.35rem !important;
  font-weight: 900 !important;
  line-height: 1;
}

.exp-operation-scope {
  overflow: hidden;
  color: var(--neutral-400);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-operation-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex-shrink: 0;
  border-radius: 9px;
  background: color-mix(in srgb, var(--exp-tone) 10%, var(--bg-card));
  color: var(--exp-tone);
}

.exp-filter-panel {
  padding: 1rem !important;
  border: 1px solid color-mix(in srgb, #0f766e 10%, var(--border-color)) !important;
  border-radius: 18px !important;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.025), transparent 28%),
    var(--bg-card) !important;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.exp-filter-panel .form-label {
  margin-bottom: 0.35rem;
  color: var(--neutral-500);
  font-size: 0.68rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.exp-filter-panel .form-input,
.exp-filter-panel .btn {
  min-height: 42px;
  border-radius: 11px;
}

.exp-filter-search .form-input {
  border-color: color-mix(in srgb, var(--primary) 20%, var(--border-color));
  background: color-mix(in srgb, #eff6ff 30%, var(--bg-card));
}

.exp-active-toggle-wrap,
.exp-filter-actions {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.15rem;
}

.exp-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: 11px;
  background: var(--bg-soft);
  color: var(--neutral-600);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.exp-active-toggle input { accent-color: var(--primary); }
.exp-filter-actions { gap: 0.5rem; margin-left: auto; }
.exp-more-filters.is-active {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border-color));
  background: color-mix(in srgb, var(--primary) 7%, var(--bg-card));
  color: var(--primary);
}

.exp-preset-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .exp-page-head {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
  .exp-new-btn {
    width: 100%;
    justify-content: center;
  }
  .exp-preset-bar {
    margin-top: 0.25rem;
  }
  .exp-preset-bar .btn {
    flex: 1;
    justify-content: center;
  }
}

/* Expedientes list ✅ responsive */
.exp-cards-mobile { display: none; }
.exp-table-wrapper { overflow-x: auto; }
/* Anchos: mandan los definidos en cada <th>. La tabla no baja de 1380px:
   en pantallas mas estrechas aparece scroll horizontal, nunca solapes. */
.exp-table-wrapper .responsive-table { width: 100%; min-width: 1360px !important; table-layout: fixed; }
.exp-table-wrapper .responsive-table td { min-width: 0; overflow: hidden; vertical-align: middle; height: 92px; padding-left: 0.7rem; padding-right: 0.7rem; }
.exp-table-wrapper .responsive-table th { padding-left: 0.7rem; padding-right: 0.7rem; }
.exp-table-wrapper .responsive-table td:last-child { overflow: visible; }

@media (min-width: 769px) and (max-width: 1120px) {
  .exp-table-wrapper { display: none !important; }
  .exp-cards-mobile { display: flex; flex-direction: column; }
  .exp-card-mobile { display: flex; flex-direction: column; gap: 0.18rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-color); cursor: pointer; background: var(--bg-card); }
  .exp-card-mobile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.1rem; }
  .exp-card-estado { font-size: 0.67rem; font-weight: 800; padding: 0.18rem 0.5rem; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
  .exp-card-mobile-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.55rem; }
}

@media (max-width: 768px) {
  .exp-table-wrapper { display: none !important; }

  .exp-cards-mobile {
    display: flex;
    flex-direction: column;
  }

  .exp-card-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    background: var(--bg-card);
    transition: background 0.15s;
  }
  .exp-card-mobile:active {
    background: var(--bg-soft);
  }
  .exp-card-mobile:last-child {
    border-bottom: none;
  }

  .exp-card-mobile-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.1rem;
  }

  .exp-card-estado {
    font-size: 0.67rem;
    font-weight: 800;
    padding: 0.18rem 0.5rem;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 0.1rem;
  }

  .exp-card-mobile-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.4rem;
    gap: 0.5rem;
  }
}

/* FichaExpediente ✅ secciónes responsive */

/* Info grid: 3 cols ™ 2 ™ 1 */
@media (max-width: 540px) {
  .info-section-grid {
    grid-template-columns: 1fr !important;
  }
}
@media (min-width: 541px) and (max-width: 860px) {
  .info-section-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 600px) {
  /* Peritación mode selector ™ 1 col */
  .peritacion-mode-grid {
    grid-template-columns: 1fr !important;
  }

  /* Videoperitación summary cards ™ 1 col */
  .vp-summary-grid {
    grid-template-columns: 1fr !important;
  }

  /* Zona 3 cierre: fix marginLeft:auto when wrapped */
  .vp-anular-btn {
    margin-left: 0 !important;
    width: 100%;
    justify-content: center;
  }
  .vp-close-bar {
    flex-direction: column;
    align-items: stretch !important;
  }
  .vp-close-bar .btn {
    width: 100%;
    justify-content: center;
  }

  /* Recursos: 2 col ™ 1 col */
  .recursos-grid {
    grid-template-columns: 1fr !important;
  }

  /* Fecha + Hora nota: side-by-side ™ stacked */
  .fecha-hora-grid {
    grid-template-columns: 1fr !important;
  }

  /* Importar compañía: info + botones ™ 1 col */
  .import-info-grid {
    grid-template-columns: 1fr !important;
  }
  .import-btn-grid {
    grid-template-columns: 1fr !important;
  }

  /* Action bar: buttons full width on tiny screens */
  .ficha-action-bar {
    width: 100%;
  }
  .ficha-action-bar .btn {
    flex: 1 1 calc(50% - 0.35rem);
    justify-content: center;
  }
}

/* Documentos section ✅ responsive */
@media (max-width: 540px) {
  .doc-item {
    flex-wrap: wrap;
    align-items: flex-start !important;
  }
  .doc-item-info {
    flex: 1 1 0;
    min-width: 0;
  }
  .doc-item-actions {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    padding-top: 0.4rem;
    margin-top: 0.15rem;
  }
  .doc-item-actions .btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
  }
  .doc-section-header .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Header */
.header.header-invo {
  height: 70px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.4rem;
}

.header-invo-left,
.header-invo-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-invo-secondary { display: flex; align-items: center; gap: 0.6rem; }
.header-invo-more-trigger,
.header-invo-mobile-account,
.header-invo-mobile-utilities { display: none; }

.header-invo-search {
  width: 380px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-soft);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.header-invo-search:focus-within {
  border-color: #bfdbfe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
  background: var(--bg-card);
}

.header-invo-search-input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-main);
}

.header-invo-search-input::placeholder {
  color: var(--text-muted);
}

.header-invo-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 80;
}

.header-invo-search-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-align: left;
  padding: 0.56rem 0.68rem;
  border-bottom: 1px solid var(--border-color);
}

.header-invo-search-row:hover {
  background: var(--bg-soft);
}

.header-invo-search-row:last-child {
  border-bottom: none;
}

.header-invo-search-ref {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
}

.header-invo-search-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.header-invo-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.header-invo-icon-btn:hover {
  background: var(--bg-soft);
  color: var(--text-main);
}

.header-invo-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #1f6fff;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.header-invo-user {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.25rem;
  border-radius: 999px;
}

.header-invo-avatar {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  overflow: hidden;
  background: #1f6fff;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-invo-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
}

.header-invo-user-meta strong {
  font-size: 0.77rem;
  color: var(--text-main);
}

.header-invo-user-meta small {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.header-invo-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 90;
}

.header-invo-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.72rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
}

.header-invo-popover-head button {
  font-size: 0.68rem;
  color: var(--primary);
}

.header-invo-popover-list {
  max-height: 290px;
  overflow-y: auto;
}

.header-invo-popover-item {
  width: 100%;
  display: flex;
  gap: 0.5rem;
  text-align: left;
  padding: 0.62rem 0.72rem;
  border-bottom: 1px solid var(--border-color);
}

.header-invo-popover-item:hover {
  background: var(--bg-soft);
}

.header-invo-popover-item:last-child {
  border-bottom: none;
}

.header-invo-popover-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
}

.header-invo-popover-text {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.header-invo-menu-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.52rem;
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
}

.header-invo-menu-btn:hover {
  background: var(--bg-soft);
}

.header-invo-menu-btn.díanger {
  color: #dc2626;
}

/* Dashboard */
.invo-dashboard {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.invo-dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.invo-dashboard-title {
  font-size: 1.32rem;
  letter-spacing: -0.02em;
  color: #1e293b;
  font-weight: 800;
}

.invo-dashboard-subtitle {
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.84rem;
}

.invo-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0.15rem;
}

.invo-strip-item {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  text-align: left;
  padding: 0.85rem 0.95rem;
  border-right: 1px solid var(--border-soft);
}

.invo-strip-item:last-child {
  border-right: none;
}

.invo-strip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.invo-strip-dot.orange { background: #f97316; }
.invo-strip-dot.green { background: #16a34a; }
.invo-strip-dot.blue { background: #0284c7; }
.invo-strip-dot.pink { background: #e11d48; }

.invo-strip-label {
  font-size: 0.72rem;
  color: #64748b;
}

.invo-strip-value {
  margin-top: 0.1rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: #1f2937;
}

.invo-grid-top {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
  gap: 0.85rem;
}

.invo-chart-card {
  padding: 0.95rem;
}

.invo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.invo-card-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #1f2937;
}

.invo-card-amount {
  margin-top: 0.1rem;
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 800;
  color: #1e293b;
}

.invo-bars {
  margin-top: 1.05rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.55rem;
  min-height: 140px;
}

.invo-bar-item {
  flex: 1;
  text-align: center;
}

.invo-bar-track {
  height: 112px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.invo-bar-fill {
  width: 24px;
  border-radius: 8px;
  background: linear-gradient(180deg, #1f6fff 0%, #3b82f6 100%);
}

.invo-bar-label {
  margin-top: 0.32rem;
  font-size: 0.66rem;
  color: #94a3b8;
}

.invo-highlight-card {
  border-radius: 14px;
  padding: 1rem;
  color: #fff;
  background: linear-gradient(155deg, #1d4ed8 0%, #1f6fff 50%, #13b3e5 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.invo-highlight-pill {
  align-self: flex-start;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.14rem 0.5rem;
  background: rgba(255, 255, 255, 0.18);
}

.invo-highlight-card h3 {
  font-size: 1.18rem;
  line-height: 1.16;
  font-weight: 800;
}

.invo-highlight-card p {
  font-size: 0.8rem;
  color: rgba(241, 245, 249, 0.92);
}

.invo-highlight-btn {
  align-self: flex-start;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  background: #fff;
  color: #1d4ed8;
}

.invo-grid-bottom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.invo-activity-list,
.invo-agenda-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.invo-activity-item {
  width: 100%;
  text-align: left;
  border: 1px solid #edf2f7;
  border-radius: 10px;
  background: #fff;
  padding: 0.55rem 0.62rem;
}

.invo-activity-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.invo-activity-ref {
  font-size: 0.72rem;
  font-weight: 800;
  color: #1f6fff;
}

.invo-activity-time {
  font-size: 0.67rem;
  color: #94a3b8;
}

.invo-activity-text {
  margin-top: 0.18rem;
  font-size: 0.78rem;
  color: #1f2937;
}

.invo-activity-client {
  margin-top: 0.15rem;
  font-size: 0.71rem;
  color: #64748b;
}

.invo-capture-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.invo-capture-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.invo-agenda-item {
  border: 1px solid #edf2f7;
  border-radius: 10px;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.invo-agenda-main {
  text-align: left;
}

.invo-agenda-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1f2937;
}

.invo-agenda-meta {
  margin-top: 0.12rem;
  font-size: 0.72rem;
  color: #64748b;
}

.invo-agenda-actions {
  display: flex;
  gap: 0.24rem;
}

.invo-table-wrap {
  overflow-x: auto;
}

.invo-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.invo-table th {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
}

.invo-table td {
  font-size: 0.77rem;
  color: #334155;
  padding: 0.55rem 0.4rem;
  border-top: 1px solid #f1f5f9;
}

.invo-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.66rem;
  font-weight: 700;
}

.invo-status-ok {
  background: #dcfce7;
  color: #166534;
}

.invo-status-warn {
  background: #fef3c7;
  color: #92400e;
}

.invo-status-new {
  background: #dbeafe;
  color: #1d4ed8;
}

.invo-status-normal {
  background: #f1f5f9;
  color: #334155;
}

.invo-empty {
  border: 1px díashed #dbe4f0;
  border-radius: 10px;
  text-align: center;
  padding: 1rem;
  color: #94a3b8;
  font-size: 0.78rem;
}

.kanban-kpi-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kanban-board-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.kanban-column {
  min-height: 260px;
}

.kanban-column-body {
  min-height: 360px;
}

@media (max-width: 1200px) {
  .kanban-kpi-grid,
  .kanban-board-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .invo-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .invo-strip-item {
    border-right: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
  }

  .invo-grid-top,
  .invo-grid-bottom {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .sidebar.sidebar-invo {
    position: fixed;
    left: -230px;
    top: 0;
    bottom: 0;
    transition: transform 0.25s ease;
  }

  .sidebar.sidebar-invo.open {
    transform: translateX(230px);
  }

  .header-invo-search {
    width: 280px;
  }
}

@media (max-width: 640px) {
  .kanban-kpi-grid,
  .kanban-board-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-invo-search {
    width: 100%;
    min-width: 0;
  }

  .header-invo-left,
  .header-invo-right {
    min-width: 0;
  }

  .header.header-invo {
    gap: 0.5rem;
    padding: 0 0.75rem;
  }

  .header-invo-popover {
    width: min(92vw, 320px) !important;
    right: 0;
  }

  .invo-capture-row {
    grid-template-columns: minmax(0, 1fr);
  }

.invo-agenda-item {
  grid-template-columns: minmax(0, 1fr);
}
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
@keyframes progressSlide {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

.spin {
  animation: spin 1s linear infinite;
}

/* Expediente Row Responsive */
.exp-row-grid {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(160px, 1.2fr) minmax(180px, 1fr) minmax(150px, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.exp-row-grid:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 1024px) {
  .exp-row-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 
      "meta status"
      "client action"
      "footer footer";
    gap: 0.75rem;
  }
 
 .exp-row-meta { grid-area: meta; }
 .exp-row-client { grid-area: client; }
 .exp-row-status { grid-area: status; justify-self: flex-end; }
 .exp-row-action { grid-area: action; }
 .exp-row-footer { grid-area: footer; }
}

@media (max-width: 640px) {
 .exp-row-grid {
  grid-template-columns: 1fr;
  grid-template-areas: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  }
 
 .exp-row-status { align-self: flex-start; }
 .exp-row-action { margin-top: 0.25rem; }
}

/*
   MOBILE RESPONSIVE GLOBAL FIXES
*/

@media (max-width: 768px) {
  html, body, #root {
    overflow-x: hidden;
    max-width: 100vw;
  }
  * { box-sizing: border-box; }
  img, video, canvas { max-width: 100%; }
  /* Safari/iOS amplía toda la página al enfocar campos con una tipografía
     inferior a 16px. El zoom se conserva al volver de un expediente al
     panel, de ahí que el dashboard pareciera desajustado. */
  .app-shell input:not([type='checkbox']):not([type='radio']):not([type='range']),
  .app-shell textarea,
  .app-shell select,
  /* Los modales viven en document.body mediante portal, fuera de .app-shell. */
  .app-modal-panel input:not([type='checkbox']):not([type='radio']):not([type='range']),
  .app-modal-panel textarea,
  .app-modal-panel select {
    font-size: 16px !important;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .app-modal-overlay {
    padding: max(.4rem, env(safe-area-inset-left)) max(.4rem, env(safe-area-inset-right)) !important;
    align-items: flex-start !important;
  }

  .app-modal-panel {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100% - .8rem) !important;
    margin-block: .4rem;
    animation: none !important;
  }

  .quick-capture-form { gap:.5rem; }
  .quick-capture-shortcuts { display:none; }
  .quick-capture-form .form-group { gap:.3rem; }
  .quick-capture-voice { min-height:54px; margin-bottom:.35rem; padding:.5rem .6rem; }
  .quick-capture-form textarea.form-input { min-height:82px !important; max-height:120px; padding:.6rem !important; }
  /* Con el teclado abierto no hay sitio para voz, texto y el botón fijo. Al
     escribir se deja solo el formulario manual y el botón sigue el flujo:
     Safari no puede superponerlo sobre el textarea. */
  .quick-capture-form.is-writing .quick-capture-voice { display:none; }
  .quick-capture-form.is-writing .quick-capture-voice-message,
  .quick-capture-form.is-writing .quick-capture-dictation-error { display:none; }
  .quick-capture-submit { width:100%; min-height:46px; justify-content:center; flex:0 0 auto; }
  .quick-capture-submit:disabled { opacity:.48; box-shadow:none; }
}

/* AUTH CARD always light regardless of theme */
.auth-card .form-label {
  color: #475569;
}

.auth-card .form-input {
  background: #ffffff;
  color: #0f172a;
  border-color: #e2e8f0;
}

.auth-card .form-input::placeholder {
  color: #94a3b8;
}

/* AUTH CARD RESPONSIVE (Login / Forgot / Recovery) */
@media (max-width: 480px) {
  .auth-page-wrapper {
    align-items: flex-start !important;
    padding: 1.5rem 0 2rem !important;
  }

  .auth-card {
    padding: 1.5rem !important;
    border-radius: 16px !important;
    width: calc(100% - 2rem) !important;
    max-width: calc(100% - 2rem) !important;
  }

  /* Prevent iOS Safari auto-zoom on input focus */
  .auth-card .form-input {
    font-size: 1rem !important;
  }

  /* Ensure icon never overlaps text on narrow screens */
  .auth-card .form-input[style] {
    padding-left: 2.75rem !important;
  }
}

@media (max-width: 640px) {
  /* Safe areas */
  body {
    padding: 0;
    overscroll-behavior-x: none;
  }
  .app-shell,
  .app-main,
  .app-content {
    min-width: 0 !important;
    max-width: 100% !important;
    overscroll-behavior-x: none;
  }
  .content-area {
    padding: 0.6rem 0.55rem calc(1.2rem + env(safe-area-inset-bottom, 0px));
  }

  /*  Sticky header  */
  .header {
    position: sticky !important;
    top: 0 !important;
    z-index: 90 !important;
    height: 58px !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.94) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 0 0.85rem !important;
  }

  /*  Hamburger 44x44  */
  .header button {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  /*  Compact cards  */
  .card {
    padding: 0.5rem;
    border-radius: var(--radius-md);
  }

  /**/
  .theme-hero {
    padding: 0.7rem !important;
    gap: 0.5rem !important;
  }

  /*  Page shell reduce gap  */
  .page-shell {
    gap: 0.35rem !important;
    padding-bottom: 1rem !important;
  }
  .page-head {
    margin-bottom: 0.1rem !important;
    gap: 0.3rem !important;
  }

/*  Single column for all multi-col layouts */
  .responsive-video-grid,
  .responsive-main-with-aside,
  .responsive-three-col,
  .responsive-two-col,
  .responsive-split-main {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.6rem;
  }

  /*  Kanban single column, compact cards  */
  .kanban-board-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.5rem;
  }
  .kanban-column {
    max-height: none !important;
    min-height: auto !important;
  }
  .kanban-column-body {
    min-height: 32px !important;
    padding: 0.35rem !important;
    gap: 0.3rem !important;
  }

  /**/
  .responsive-week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.35rem;
  }

  /*  Smaller form elements  */
  .form-input {
    padding: 0.45rem 0.55rem !important;
    font-size: 0.8rem;
    height: auto;
  }
  .form-label {
    font-size: 0.7rem;
    margin-bottom: 0.15rem;
  }
  .form-group {
    margin-bottom: 0.35rem;
  }

/*  Page head compact */
  .page-head {
    margin-bottom: 0.15rem;
    gap: 0.35rem;
  }
  .page-title {
    font-size: 1.15rem;
  }

/*  Toolbar buttons wrap nicely */
  .toolbar {
    gap: 0.35rem;
    flex-wrap: wrap;
  }

  /*  Company row single column  */
  .responsive-company-row {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.45rem !important;
  }

  /**/
  .dashboard-task-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.4rem 0.5rem;
  }

  /**/
  .exp-row-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  /**/
  .btn {
    min-height: 38px;
  }
  .btn-primary {
    min-height: 42px;
  }

  /*  Header search full width  */
  .header-invo {
    gap: 0.4rem;
  }
  .header-invo-left {
    flex: 1;
    min-width: 0;
  }
  .header-invo-search {
    width: 100%;
    max-width: 100%;
  }
  .header-invo-search-input {
    font-size: 0.8rem;
  }
  .header-invo-right {
    gap: 0.25rem;
  }

/*  Filtro bar collapse */
  .filter-bar {
    flex-direction: column;
    gap: 0.35rem;
  }
  .filter-bar > * {
    width: 100%;
  }

  /*  Expedientes: filter card compact  */
  .responsive-filter-card {
    flex-direction: column !important;
    gap: 0.4rem !important;
    padding: 0.6rem !important;
  }
  .responsive-filter-card .form-group {
    margin-bottom: 0 !important;
    gap: 0.15rem !important;
  }
  .responsive-filter-card select,
  .responsive-filter-card .form-input {
    height: 42px;
    min-height: 42px;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-right: 0.6rem !important;
  }
  /* Search input needs left space for the icon */
  .responsive-filter-card .mobile-only .form-input,
  .responsive-filter-card .desktop-only .form-input {
    padding-left: 2.2rem !important;
  }

  /**/
  .contact-item {
    padding: 0.55rem 0.6rem !important;
    min-height: auto !important;
  }

  /*  Dashboard: compact KPIs  */
  .theme-hero {
    padding: 0.5rem !important;
    gap: 0.35rem !important;
    border-radius: 14px !important;
  }
  .responsive-dashboard-hero {
    flex-direction: column !important;
    gap: 0.3rem !important;
  }
  .responsive-dashboard-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.3rem !important;
  }
  .responsive-dashboard-kpis button,
  .responsive-dashboard-kpis .btn {
    min-height: 48px !important;
    max-height: 58px !important;
    padding: 0.3rem 0.4rem !important;
    border-radius: 10px !important;
    gap: 0.1rem !important;
  }
  .responsive-dashboard-kpis button span:first-child,
  .responsive-dashboard-kpis .btn span:first-child {
    font-size: 0.65rem !important;
  }
  .responsive-dashboard-kpis button div:last-child,
  .responsive-dashboard-kpis .btn div:last-child {
    font-size: 0.6rem !important;
  }

  /*  Agenda: compact controls  */
  .page-head .toolbar {
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  /*  Agenda header 2-row layout  */
  .agenda-nav .btn,
  .agenda-view-tabs .btn {
    flex: 0 0 auto !important;
    width: auto !important;
  }

/*  All cards: auto height, no min-height */
  .card {
    min-height: auto !important;
    padding: 0.55rem;
  }
  .card section,
  .card > div {
    min-height: auto !important;
  }

/*  Any fixed height cards ™ auto */
  [class*="kpi-card"],
  [class*="metric-card"],
  [class*="summary-card"] {
    min-height: auto !important;
  }

  /**/
  .form-input {
    height: 44px;
    padding: 0 0.6rem !important;
    font-size: 0.82rem !important;
  }
  textarea.form-input {
    height: auto;
  }

  /*  Alerts compact  */
  .alert-inline {
    padding: 0.5rem 0.6rem;
    font-size: 0.75rem;
  }

  /*  Select inputs  */
  select.form-input {
    height: 44px;
  }
}

/**/
.ficha-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 0.75rem;
  align-items: start;
  width: 100%;
}
.ficha-left {
  grid-column: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  min-width: 0;
  overflow-x: hidden;
}
.ficha-right {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  position: sticky;
  top: 76px;
  align-self: start;
  min-width: 0;
  overflow-x: hidden;
}
@media (max-width: 768px) {
  .ficha-grid {
    grid-template-columns: 1fr;
  }
  .ficha-left,
  .ficha-right {
    grid-column: 1;
  }
  .ficha-right {
    position: static;
  }
}

/* ── Vista de control (gerencia/oficina): sin columna lateral estrecha ──
   El contenido de gestión (comunicaciones, cierre, informe, minuta, galería,
   documental…) pasa a una rejilla de 2 columnas a ancho completo debajo de
   la información del expediente: menos scroll y módulos legibles. Solo en
   escritorio; en móvil/tablet sigue apilado a una columna. */
@media (min-width: 769px) {
  .ficha-grid.ficha-control {
    grid-template-columns: 1fr;
  }
  .ficha-grid.ficha-control .ficha-left,
  .ficha-grid.ficha-control .ficha-right {
    grid-column: 1;
  }
  /* Flujo multicolumna (masonry): cada columna se rellena de arriba a abajo,
     sin los huecos que deja una rejilla por filas cuando un módulo corto
     queda al lado de uno alto. El ORDEN es el del DOM (viewConfig): trabajo
     diario → económico/cierre → utilidades colapsadas al final. */
  .ficha-grid.ficha-control .ficha-right {
    position: static;
    display: block;
    columns: 2;
    column-gap: 0.75rem;
  }
  /* Por defecto TODO a ancho completo (sin huecos ni secciones descolgadas). */
  .ficha-grid.ficha-control .ficha-right > * {
    break-inside: avoid;
    margin-bottom: 0.75rem;
    min-width: 0;
    column-span: all;
  }
  /* Solo las secciones ligeras emparejadas fluyen en las 2 columnas. */
  .ficha-grid.ficha-control .ficha-right > .ficha-mod-light {
    column-span: none;
  }
}

/* Distintivo de color por sección de la ficha: raíl a la izquierda de la
   tarjeta (mismo patrón que los colapsables de abajo), para diferenciarlas. */
.ficha-mod > .card,
.ficha-mod > section.card,
.ficha-mod > section {
  border-left: 4px solid var(--mod-accent, var(--border-color));
}

/* Económico · Documentos · Actividad. Por defecto apiladas (perito/móvil). */
.ficha-3col { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.ficha-3col-cell { min-width: 0; }

/* Centro único de archivos y evidencias del expediente */
.ficha-evidence-hub {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.ficha-evidence-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 0.7rem;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
}

.exp-row-more { position: relative; flex: 0 0 auto; }
.exp-row-more > summary { display:grid; width:34px; height:34px; place-items:center; border:1px solid var(--border-color); border-radius:10px; color:var(--neutral-500); background:var(--bg-card); cursor:pointer; list-style:none; }
.exp-row-more > summary::-webkit-details-marker { display:none; }
.exp-row-more > div { position:absolute; z-index:40; top:calc(100% + .35rem); right:0; min-width:180px; padding:.32rem; border:1px solid var(--border-color); border-radius:10px; background:var(--bg-card); box-shadow:0 14px 30px rgba(15,23,42,.16); }
.exp-row-more button { display:flex; width:100%; align-items:center; gap:.4rem; padding:.5rem .55rem; border:0; border-radius:7px; color:#b91c1c; background:transparent; font:inherit; font-size:.72rem; font-weight:750; cursor:pointer; }
.exp-row-more button:hover { background:#fef2f2; }

@media (max-width: 1100px) {
  .exp-operations-grid { grid-template-columns: repeat(3,minmax(150px,1fr)) !important; }
}

.ficha-evidence-tab {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.38rem;
  min-height: 70px;
  padding: 0.65rem 0.75rem;
  border: 1px solid #dbe5f2;
  border-radius: 13px;
  color: var(--text-muted);
  background: #fff;
  font-size: 0.76rem;
  font-weight: 750;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.ficha-evidence-tab > span:not(.ficha-evidence-step) { display: grid; min-width: 0; gap: .12rem; }
.ficha-evidence-tab > span strong { overflow: hidden; color: inherit; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.ficha-evidence-tab > span small { overflow: hidden; color: var(--neutral-500); font-size: .64rem; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.ficha-evidence-step { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #f1f5f9; color: #64748b; }

.ficha-evidence-tab:hover {
  color: var(--text-main);
  border-color: #cbd5e1;
  background: #f8fafc;
}

.ficha-evidence-tab.is-active {
  color: var(--primary-strong);
  background: var(--bg-card);
  border-color: #a5b4fc;
  box-shadow: 0 8px 22px rgba(79,70,229,.09);
}
.ficha-evidence-tab.is-photos.is-active { color:#0369a1; border-color:#7dd3fc; background:#f0f9ff; }
.ficha-evidence-tab.is-photos.is-active .ficha-evidence-step { color:#0369a1; background:#e0f2fe; }
.ficha-evidence-tab.is-documents.is-active { color:#4338ca; border-color:#a5b4fc; background:#eef2ff; }
.ficha-evidence-tab.is-documents.is-active .ficha-evidence-step { color:#4338ca; background:#e0e7ff; }
.ficha-evidence-tab.is-dossier.is-active { color:#7e22ce; border-color:#d8b4fe; background:#faf5ff; }
.ficha-evidence-tab.is-dossier.is-active .ficha-evidence-step { color:#7e22ce; background:#f3e8ff; }

.ficha-evidence-tab b {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--neutral-100);
  color: var(--text-muted);
  font-size: 0.66rem;
}

.ficha-evidence-tab.is-active b {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.ficha-evidence-panel {
  min-width: 0;
  overflow: hidden;
  padding: .8rem;
  border: 1px solid #dbe5f2;
  border-radius: 14px;
  background: #fff;
}
.ficha-evidence-panel.is-photos { border-top: 3px solid #0ea5e9; }
.ficha-evidence-panel.is-documents { border-top: 3px solid #6366f1; }
.ficha-evidence-panel.is-dossier { border-top: 3px solid #a855f7; }
.ficha-section-heading { display:inline-flex; align-items:center; gap:.6rem; min-width:0; }
.ficha-section-heading > span { display:grid; gap:.08rem; min-width:0; }
.ficha-section-heading strong { color:inherit; font-size:.82rem; line-height:1.15; }
.ficha-section-heading small { color:#64748b; font-size:.62rem; font-weight:550; line-height:1.2; }
.ficha-evidence-section .mobile-collapsible-toggle { min-height:54px; border-color:#99f6e4; border-left:4px solid #0f766e !important; background:linear-gradient(90deg,#ecfdf5 0%,#f0fdfa 36%,#fff 78%); }
.ficha-evidence-section .mobile-collapsible-title { color:#0f766e; }
.ficha-evidence-section .mobile-collapsible-body.is-open { margin-top:.55rem; padding:.75rem; border:1px solid #99f6e4; border-radius:14px; background:#f0fdfa; box-shadow:inset 0 1px 0 rgba(255,255,255,.9); }
.ficha-expediente-messages { margin-top:.9rem; }
.ficha-expediente-messages .mobile-collapsible-toggle { min-height:54px; border-color:#ddd6fe; border-left:4px solid #7c3aed !important; background:linear-gradient(90deg,#f5f3ff 0%,#faf5ff 36%,#fff 78%); }
.ficha-expediente-messages .mobile-collapsible-title { color:#6d28d9; }
.ficha-expediente-messages .mobile-collapsible-body.is-open { margin-top:.55rem; padding:.75rem; border:1px solid #ddd6fe; border-radius:14px; background:#faf5ff; box-shadow:inset 0 1px 0 rgba(255,255,255,.9); }
.ficha-expediente-messages .ficha-messages-purpose { color:#5b21b6; background:#f5f3ff; border-color:#ddd6fe; }

/* Espacio documental: acción principal visible; utilidades avanzadas bajo demanda. */
.document-workspace-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.document-workspace-title { display:flex; align-items:center; gap:.65rem; min-width:0; }
.document-workspace-title > span { display:grid; place-items:center; width:38px; height:38px; flex:0 0 38px; border-radius:11px; color:#4338ca; background:#e0e7ff; }
.document-workspace-title > div { display:grid; gap:.1rem; min-width:0; }
.document-workspace-title h3 { margin:0; color:#0f172a; font-size:.9rem; }
.document-workspace-title small { overflow:hidden; color:#64748b; font-size:.67rem; text-overflow:ellipsis; white-space:nowrap; }
.document-workspace-primary-actions { display:flex; align-items:center; justify-content:flex-end; gap:.45rem; flex-wrap:wrap; }
.document-workspace-primary-actions select { width:auto; min-width:135px; min-height:36px; padding:.32rem .55rem; font-size:.72rem; }
.document-workspace-tools { border:1px solid #e2e8f0; border-radius:11px; background:#fff; }
.document-workspace-tools > summary { display:flex; align-items:center; justify-content:space-between; min-height:38px; padding:.45rem .65rem; color:#475569; font-size:.72rem; font-weight:750; cursor:pointer; list-style:none; }
.document-workspace-tools > summary::-webkit-details-marker { display:none; }
.document-workspace-tools > summary span { display:inline-flex; align-items:center; gap:.35rem; }
.document-workspace-tools > summary > svg { transition:transform .16s ease; }
.document-workspace-tools[open] > summary > svg { transform:rotate(180deg); }
.document-workspace-tools-body { display:grid; gap:.55rem; padding:.65rem; border-top:1px solid #e2e8f0; background:#f8fafc; }
.document-workspace-search { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.4rem; }
.document-workspace-search input { min-height:36px; font-size:.73rem; }
.document-workspace-secondary-actions { display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; }
.document-workspace-secondary-actions .btn { min-height:34px; font-size:.7rem; }
.document-workspace-list { display:grid; gap:.4rem; }
.document-workspace-row { position:relative; display:flex; align-items:center; gap:.5rem; min-height:48px; padding:.45rem .55rem; border:1px solid #e2e8f0; border-radius:11px; color:#475569; background:#fff; font-size:.75rem; cursor:pointer; transition:border-color .15s, box-shadow .15s, background .15s; }
.document-workspace-row:hover, .document-workspace-row:focus-visible { border-color:#a78bfa; box-shadow:0 3px 12px rgba(124,58,237,.12); outline:none; }
.document-workspace-row.is-duplicate { border-color:#e9d5ff; background:#fdf4ff; }
.document-workspace-name { flex:1 1 180px; min-width:0; overflow:hidden; color:#1e293b; font-weight:750; text-overflow:ellipsis; white-space:nowrap; }
.document-workspace-row > .form-input { flex:0 1 235px; min-width:125px; }
.document-workspace-date { color:#94a3b8; font-size:.67rem; white-space:nowrap; }
.document-workspace-more { display:grid; flex:0 0 auto; place-items:center; width:30px; height:30px; padding:0; border:1px solid #e2e8f0; border-radius:8px; color:#64748b; background:#fff; cursor:pointer; }
.document-workspace-more:hover { border-color:#c4b5fd; color:#6d28d9; background:#faf5ff; }
.document-actions-modal { display:grid; gap:.55rem; }
.document-actions-modal-name { margin:0 0 .25rem; overflow:hidden; color:#475569; font-size:.78rem; font-weight:700; text-overflow:ellipsis; white-space:nowrap; }
.document-actions-modal button { display:flex; align-items:center; gap:.55rem; width:100%; min-height:42px; padding:.65rem .75rem; border:1px solid #dbe5f2; border-radius:9px; color:#334155; background:#fff; font:inherit; font-size:.8rem; font-weight:750; text-align:left; cursor:pointer; }
.document-actions-modal button:hover { border-color:#c4b5fd; background:#faf5ff; }
.document-actions-modal button.is-danger { color:#b91c1c; border-color:#fecaca; }
.document-actions-modal button.is-danger:hover { background:#fef2f2; }
@media (max-width:900px) {
  .document-workspace-header { align-items:flex-start; flex-direction:column; }
  .document-workspace-primary-actions { width:100%; justify-content:stretch; }
  .document-workspace-primary-actions select { flex:1; }
  .document-workspace-row { flex-wrap:wrap; }
  .document-workspace-name { flex-basis:calc(100% - 92px); }
  .document-workspace-row > .form-input { flex:1 1 100%; order:5; width:100% !important; }
  .document-workspace-date { display:none; }
}
@media (max-width:560px) {
  .document-workspace-title small { white-space:normal; line-height:1.35; }
  .document-workspace-primary-actions .btn { width:100%; }
  .document-workspace-search { grid-template-columns:1fr; }
  .document-workspace-search .btn { width:100%; }
}

.ficha-messages-purpose {
  margin-bottom: .65rem;
  padding: .6rem .7rem;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  color: #31566d;
  background: #f0f9ff;
  font-size: .72rem;
  line-height: 1.45;
}

.ficha-evidence-embedded {
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ficha-evidence-panel > .card,
.ficha-evidence-panel > section.card,
.ficha-evidence-panel > div > .card,
.ficha-evidence-panel > div > section.card {
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
/* En la vista de control (ancho completo): 3 columnas iguales, alto fijo y
   scroll interno para que las tres se vean igualadas. */
@media (min-width: 769px) {
  .ficha-grid.ficha-control .ficha-3col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ficha-grid.ficha-control .ficha-3col-cell {
    height: 560px;
    display: flex;
  }
  .ficha-grid.ficha-control .ficha-3col-cell > * {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 0 !important;
  }
}

/* Mobile polish: overrides for dense expediente screens */
@media (max-width: 640px) {
  html,
  body,
  #root {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-layout,
  .app-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
  }

  .app-layout,
  .app-shell,
  .main-content,
  .app-main,
  .content-area,
  .app-content,
  .page-shell {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  .content-area,
  .app-content {
    padding: 0.75rem 0.5rem calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .page-shell {
    gap: 0.65rem !important;
  }

  .ficha-evidence-tabs {
    margin-inline: -0.15rem;
    padding: 0.25rem;
    scroll-snap-type: x proximity;
  }

  .ficha-evidence-tab {
    flex: 0 0 auto;
    min-height: 42px;
    padding-inline: 0.65rem;
    scroll-snap-align: start;
  }

  .ficha-evidence-panel {
    width: 100%;
    overflow-x: hidden;
  }

  .card,
  .page-head,
  .toolbar,
  .ficha-left,
  .ficha-right,
  .responsive-main-with-aside,
  .responsive-split-main,
  .responsive-two-col,
  .responsive-three-col {
    min-width: 0;
  }

  .section-title,
  .page-title,
  .page-subtitle {
    overflow-wrap: anywhere;
  }

  /* Top app header */
  .header.header-invo {
    height: calc(58px + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(58px + env(safe-area-inset-top, 0px)) !important;
    padding: env(safe-area-inset-top, 0px) 0.85rem 0 !important;
    gap: 0.5rem !important;
  }

  .header-invo-left {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    gap: 0.5rem !important;
  }

  .header-invo-right {
    flex: 0 0 auto !important;
    gap: 0.35rem !important;
  }

  .header-invo-secondary,
  .header-invo-theme,
  .header-invo-user {
    display: none !important;
  }

  .header-invo-more-trigger {
    display: grid !important;
  }

  .header-invo-search {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    height: 40px !important;
    padding: 0.4rem 0.75rem !important;
    gap: 0.4rem !important;
  }

  .header-invo-search-input {
    min-width: 0 !important;
    /* iOS Safari amplía automáticamente la página al enfocar inputs por
       debajo de 16px. Mantener este tamaño evita el zoom y que los
       resultados de búsqueda queden recortados. */
    font-size: 16px !important;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .header-invo-icon-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
  }

  .header-invo-avatar {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.72rem !important;
  }

  .header-invo-user {
    width: 38px !important;
    min-width: 38px !important;
    padding: 0 !important;
  }

  .header-invo-popover,
  .header-invo-search-results {
    position: fixed !important;
    top: 56px !important;
    left: 0.5rem !important;
    right: 0.5rem !important;
    width: auto !important;
    max-width: calc(100vw - 1rem) !important;
  }

  .header-invo-popover-list {
    max-height: min(70vh, 430px) !important;
  }

  .header-invo-account-menu .header-invo-popover-list {
    display: grid;
    gap: 0.35rem;
    padding: 0.55rem !important;
  }

  .header-invo-mobile-account {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.4rem 0.55rem;
    border-bottom: 1px solid var(--border-color);
  }

  .header-invo-mobile-account > span:last-child { display: grid; min-width: 0; gap: 0.1rem; }
  .header-invo-mobile-account strong { overflow: hidden; color: var(--text-main); font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
  .header-invo-mobile-account small { overflow: hidden; color: var(--text-muted); font-size: 0.65rem; text-overflow: ellipsis; white-space: nowrap; }
  .header-invo-mobile-utilities { display: grid; gap: 0.3rem; }
  .header-invo-mobile-utilities > :not(.header-invo-menu-btn) { min-height: 42px; }

  .sidebar.sidebar-invo {
    width: min(86vw, 288px) !important;
    left: calc(-1 * min(86vw, 288px)) !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  .sidebar.sidebar-invo.open {
    transform: translateX(min(86vw, 288px)) !important;
  }

  .sidebar-backdrop {
    inset: 0 !important;
  }

  .header.header-invo {
    position: sticky;
    top: 0;
    z-index: 70;
  }

  /* Dashboard */
  .dashboard-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
  }

  .dashboard-actions .btn {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: center;
    white-space: normal !important;
  }

  .responsive-dashboard-hero {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 0.75rem !important;
  }

  .responsive-dashboard-hero > * {
    flex: 0 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Dashboard action buttons stack vertically on very small screens */
  .dashboard-actions {
    flex-direction: column !important;
    width: 100% !important;
  }

  .dashboard-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Grids con minmax muy grande colapsan a 1 columna */
  .split-grid-2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .responsive-dashboard-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
  }

  .responsive-dashboard-kpis .btn,
  .responsive-dashboard-kpis button {
    min-width: 0 !important;
    min-height: 58px !important;
    max-height: none !important;
    padding: 0.45rem 0.35rem !important;
  }

  .theme-hero {
    min-height: 0 !important;
  }

  /* Expedientes filters: hidden by default on mobile, shown when toggled */
  .responsive-filter-card.filters-mobile-hidden {
    display: none !important;
  }

  .responsive-filter-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.55rem !important;
  }

  .responsive-filter-card > *,
  .responsive-filter-card .form-group {
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  .responsive-filter-card .mobile-only {
    margin-bottom: 0 !important;
  }

  /* Ficha expediente header */
  .ficha-mobile-header {
    min-width: 0;
    overflow: hidden;
  }

  .ficha-title-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.55rem !important;
    align-items: stretch !important;
  }

  .ficha-title-meta {
    width: 100% !important;
    min-width: 0 !important;
    gap: 0.25rem 0.35rem !important;
  }

  .ficha-title-meta > span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .ficha-title-meta > span:first-child {
    font-size: 1.05rem !important;
    line-height: 1.15 !important;
  }

  .ficha-action-bar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    flex: 1 1 auto !important;
    gap: 0.4rem !important;
  }

  .ficha-action-bar .btn {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: center;
    white-space: nowrap !important;
    font-size: 0.82rem !important;
    padding: 0.55rem 0.5rem !important;
  }

  .ficha-action-bar .btn-díanger {
    grid-column: 1 / -1;
  }

  /* Dense sections inside ficha */
  #sec-info .contact-item {
    min-width: 0 !important;
  }

  #sec-fotos,
  #sec-redacción,
  #sec-documentos,
  #sec-peritación {
    min-width: 0;
    overflow-x: hidden;
  }

  #sec-fotos .card > div:first-child,
  #sec-fotos .card > div:first-child > div,
  #sec-fotos .card > div:nth-child(2) {
    width: 100%;
    min-width: 0;
  }

  #sec-fotos .card > div:first-child > div,
  #sec-redacción .toolbar,
  #sec-redacción [style*="flex-wrap"],
  #sec-peritación [style*="display: flex"] {
    gap: 0.35rem !important;
  }

  #sec-fotos .btn,
  #sec-redacción .btn,
  #sec-peritación .btn,
  #sec-documentos .btn {
    min-width: 0 !important;
    white-space: normal !important;
  }

  #sec-fotos .card > div[style*="grid-template-columns"] {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  #sec-documentos .card,
  #sec-documentos .card * {
    min-width: 0;
  }

  #sec-documentos .card {
    overflow: hidden;
  }

  #sec-documentos .section-title + div,
  #sec-documentos [style*="overflow"] {
    max-width: 100%;
  }

  .ficha-right .card,
  .ficha-right .btn {
    min-width: 0;
  }

  .gabinete-metric-grid,
  .gabinete-dashboard-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .gabinete-dashboard .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .content-area {
    padding-inline: 0.35rem !important;
  }

  .header-invo-search {
    height: 36px !important;
    padding-inline: 0.45rem !important;
  }

  .header-invo-icon-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
  }

  .dashboard-actions {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .responsive-dashboard-kpis {
    gap: 0.28rem !important;
  }

  .dashboard-actions {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .responsive-dashboard-kpis .btn,
  .responsive-dashboard-kpis button {
    min-height: 54px !important;
    padding: 0.35rem 0.25rem !important;
  }

  #sec-fotos .card > div[style*="grid-template-columns"] {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.3rem !important;
  }
}

/* Dashboard móvil: la entrada debe parecer una consola de trabajo, no una
   lista vertical de botones. Las acciones caben en dos columnas y los
   indicadores mantienen una lectura rápida; el detalle sigue en sus vistas. */
@media (max-width: 760px) {
  .dashboard-page { gap: .5rem !important; padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important; }
  .dashboard-page > .page-head { display: grid; gap: .45rem; margin-bottom: 0 !important; }
  .dashboard-page > .page-head .page-title { font-size: 1.45rem; line-height: 1.05; }
  .dashboard-page > .page-head .page-subtitle { margin: 0; font-size: .78rem; }
  .dashboard-page .dashboard-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .42rem !important;
    width: 100% !important;
  }
  .dashboard-page .dashboard-actions .btn {
    min-height: 44px;
    padding: .55rem .45rem !important;
    font-size: .76rem;
    line-height: 1.15;
  }
  .dashboard-page .dashboard-actions .btn.btn-primary {
    grid-column: 1 / -1;
    min-height: 48px;
  }
  .dashboard-page.is-perito-dashboard .dashboard-actions .btn.btn-primary { grid-column: auto; }

  /* El perito necesita primero cartera y prioridades; los indicadores no
     crecen innecesariamente en altura. */
  .is-perito-dashboard .perito-cockpit { gap: .5rem; }
  .is-perito-dashboard .perito-hero.perito-hero-slim { padding: .55rem; border-radius: 14px; }
  .is-perito-dashboard .perito-kpis.perito-kpis-row { gap: .35rem; }
  .is-perito-dashboard .perito-kpi { min-height: 66px; padding: .45rem; gap: .35rem; border-radius: 11px; }
  .is-perito-dashboard .perito-kpi-icon { width: 29px; height: 29px; border-radius: 8px; }
  .is-perito-dashboard .perito-kpi strong { font-size: 1.08rem; }
  .is-perito-dashboard .perito-kpi small { font-size: .57rem; }
  .is-perito-dashboard .perito-kpi em { font-size: .55rem; }
  .is-perito-dashboard .perito-workspace-grid { gap: .5rem; }
  .is-perito-dashboard .perito-focus-row { min-height: 56px; padding: .4rem .5rem; gap: .4rem; }
  .is-perito-dashboard .perito-focus-row:nth-child(n + 4) { display: none; }
  .is-perito-dashboard .perito-focus-panel .perito-panel-head { min-height: 47px; padding: .5rem .6rem; }
  .is-perito-dashboard .perito-side-stack { gap: .5rem; }

  /* Gerencia: KPIs y resumen del gabinete en bloques densos de dos columnas. */
  .manager-dashboard-page .manager-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .42rem; }
  .manager-dashboard-page .manager-kpi { min-height: 76px; padding: .55rem .5rem; }
  .manager-dashboard-page .manager-kpi:first-child { grid-column: 1 / -1; }
  .manager-dashboard-page .manager-insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
  .manager-dashboard-page .manager-insight-chart,
  .manager-dashboard-page .manager-insight-sla { min-height: 154px; padding: .6rem; }
  .manager-dashboard-page .manager-main-grid { gap: .5rem; }
  .manager-dashboard-page .manager-panel-head { min-height: 48px; padding: .5rem .6rem; }

  /* En gerencia la personalización ocupa una fila completa; las acciones
     restantes aprovechan la anchura sin dejar huecos. */
  .manager-dashboard-page .dashboard-actions .btn:first-child { grid-column: 1 / -1; }
  .manager-dashboard-page .manager-kpi:nth-child(4) { grid-column: 1 / -1; }

  /* La tarjeta del agente es un resumen, no un panel de lectura larga. */
  .manager-dashboard-page .agent-dashboard-card { gap: .4rem; padding: .55rem .62rem; }
  .manager-dashboard-page .agent-dashboard-card__title > span { width: 30px; height: 30px; }
  .manager-dashboard-page .agent-dashboard-card__metrics > div { min-height: 38px; padding: .25rem .35rem; }
  .manager-dashboard-page .agent-dashboard-card__metrics strong { font-size: .86rem; }
  .manager-dashboard-page .agent-dashboard-card__actions { gap: .3rem; }
  .manager-dashboard-page .agent-dashboard-card__actions small { font-size: .52rem; }

  /* Control de gabinete: menos aire entre bloques, conservando todos los
     datos y haciendo que la lectura prioritaria aparezca antes. */
  .manager-dashboard-page .manager-cockpit { gap: .5rem; }
  .manager-dashboard-page .manager-cockpit > .contactos-panel { margin-top: 0; }
  .manager-dashboard-page .manager-insight-grid { margin-top: 0; }
  .manager-dashboard-page .manager-query-panel,
  .manager-dashboard-page .manager-panel { border-radius: 13px; }
  .manager-dashboard-page .manager-attention-list,
  .manager-dashboard-page .manager-team-list { gap: 0; }
}

/* Las cuatro acciones de gerencia son accesos equivalentes en móvil: una
   matriz 2×2 evita tres filas y aprovecha todo el ancho del contenedor. */
@media (max-width: 760px) {
  .manager-dashboard-page .dashboard-actions .btn,
  .manager-dashboard-page .dashboard-actions .btn:first-child,
  .manager-dashboard-page .dashboard-actions .btn.btn-primary {
    grid-column: auto !important;
    min-height: 58px;
    padding: .55rem .35rem !important;
    font-size: .73rem;
  }
}

/* En la cartera del gabinete los dos últimos indicadores son consultas
   equivalentes. En móvil comparten fila para evitar dos tarjetas largas y
   vacías una debajo de otra. */
@media (max-width: 760px) {
  .manager-dashboard-page .manager-kpi:nth-child(4),
  .manager-dashboard-page .manager-kpi:nth-child(5) {
    grid-column: auto !important;
    min-height: 76px;
  }
}

@media (max-width: 390px) {
  .dashboard-page .dashboard-actions .btn { font-size: .7rem; padding-inline: .25rem !important; }
  .manager-dashboard-page .manager-insight-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Ficha expediente: subnavegación sticky + vista compacta/completa
   ============================================================ */
.ficha-subnav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.32rem 0.55rem 0.38rem;
  margin: 0.3rem 0 0.18rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-soft) 94%, var(--bg-card)) 0%, color-mix(in srgb, var(--bg-card) 98%, var(--bg-soft)) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--border-color) 96%, var(--neutral-400) 4%);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.025);
}

.ficha-subnav-label {
  flex: 0 0 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--neutral-500);
}

.ficha-subnav-label::before {
  content: '';
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: var(--neutral-400);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--neutral-400) 14%, transparent);
}

.ficha-subnav-tabs {
  display: flex;
  align-items: center;
  gap: 0.16rem;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  flex: 1 1 auto;
}
.ficha-subnav-tabs::-webkit-scrollbar { display: none; }

.ficha-subnav-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--neutral-600);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}
.ficha-subnav-tab:hover { background: var(--bg-soft); color: var(--text-main); }
.ficha-subnav-tab.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 28%, transparent);
}

.ficha-view-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-soft) 72%, #fff);
  border: 1px solid color-mix(in srgb, var(--border-color) 86%, var(--primary));
}
.ficha-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  min-height: 34px;
  padding: 0.4rem 0.78rem;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--neutral-600);
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.ficha-view-btn:hover:not(.active) { background: var(--bg-card); color: var(--text-main); }
.ficha-view-btn:active { transform: translateY(1px); }
.ficha-view-btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.ficha-view-btn.active {
  background: var(--bg-card);
  color: var(--primary-strong);
  box-shadow: var(--shadow-xs);
}

/* Selector de vista a nivel de página (fila superior de la ficha) */
.ficha-view-toggle-top {
  align-items: center;
  gap: 0.2rem;
  padding: 0.22rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.07);
  backdrop-filter: blur(8px);
}
.ficha-view-toggle-top .ficha-view-toggle-prefix {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 0.65rem 0 0.55rem;
  border-right: 1px solid var(--border-color);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--neutral-500);
  margin-right: 0.05rem;
}
.ficha-view-toggle-top .ficha-view-btn { min-width: 96px; }
.ficha-view-toggle-top .ficha-view-btn.active {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 76%, #0f3fa8));
  color: #fff;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--primary) 26%, transparent);
}

/* Desplazamiento: que la sección no quede tapada por la subnav sticky */
.ficha-grid [id^="sec-"] { scroll-margin-top: 78px; }

/* Sombra algo más marcada cuando la subnav queda pegada al hacer scroll */
.ficha-subnav { transition: box-shadow var(--transition-fast); }

/* Ficha: case header and operational state flow. */
.ficha-case-hero {
  position: relative;
  overflow: visible;
  gap: 0.8rem !important;
  padding: 0.8rem 0.95rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--primary) 15%, var(--border-color));
  border-radius: 18px;
  background:
    radial-gradient(circle at 91% 5%, color-mix(in srgb, var(--primary) 9%, transparent) 0 11%, transparent 28%),
    linear-gradient(135deg, var(--bg-card) 0%, color-mix(in srgb, var(--primary-soft) 55%, var(--bg-card)) 100%);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.055);
}

.ficha-case-hero > div:first-child {
  position: relative;
  z-index: 1;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 10%, var(--border-color));
}

.ficha-case-main {
  position: relative;
  z-index: 50;
}

.ficha-case-reference {
  font-size: clamp(1.45rem, 2.2vw, 2rem) !important;
  font-weight: 900 !important;
  letter-spacing: -0.035em;
}

.ficha-case-insured {
  font-size: 1rem !important;
}

.ficha-case-actions {
  position: relative;
  z-index: 45;
  padding-top: 0.15rem;
}

.ficha-case-actions .btn {
  min-height: 39px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.025);
}

.ficha-case-actions .btn-primary {
  background: var(--primary);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--primary) 22%, transparent);
}

.ficha-next-action {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 54px;
  padding: 0.65rem 0.8rem;
  border: 1px solid color-mix(in srgb, #0f766e 18%, var(--border-color));
  border-radius: 13px;
  background: color-mix(in srgb, #ecfdf5 62%, var(--bg-card));
}

.ficha-next-action > span {
  color: #0f766e;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ficha-next-action strong {
  overflow: hidden;
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ficha-next-action small {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--neutral-500);
  font-size: 0.76rem;
  font-weight: 650;
  white-space: nowrap;
}

.ficha-status-flow {
  position: relative;
  overflow: hidden;
  padding: 0.85rem 0.95rem 0.9rem !important;
  border-color: color-mix(in srgb, var(--primary) 13%, var(--border-color)) !important;
  border-radius: 16px !important;
  background: var(--bg-card) !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

.ficha-status-heading {
  margin-bottom: 0.7rem !important;
  color: var(--neutral-400) !important;
}

.ficha-status-steps {
  position: relative;
  flex-wrap: nowrap !important;
  gap: 0.25rem !important;
  overflow-x: auto;
  padding: 0.08rem 0.05rem 0.22rem;
  scrollbar-width: thin;
}

.ficha-status-step {
  position: relative;
  flex: 1 0 auto;
  min-width: max-content;
  border-radius: 999px !important;
  font-size: 0.75rem !important;
  padding: 0.38rem 0.72rem !important;
}

.ficha-status-step:not(.is-active):hover {
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border-color)) !important;
  background: var(--primary-soft) !important;
  color: var(--primary-strong) !important;
}

.ficha-status-step.is-active {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.ficha-subnav {
  padding: 0.45rem 0.6rem !important;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.ficha-subnav-label {
  flex-basis: auto;
  padding-left: 0.2rem;
}

/* En pantallas de escritorio la navegación del expediente muestra todas las
   secciones. Si no caben en una línea, se organiza en filas: nunca obliga a
   desplazar horizontalmente ni deja secciones cortadas. */
@media (min-width: 769px) {
  .ficha-subnav { align-items:flex-start; }
  .ficha-subnav-tabs { flex:1 1 420px; flex-wrap:wrap; overflow:visible; align-items:stretch; }
  .ficha-subnav-tab { min-height:34px; padding:.38rem .58rem; font-size:.72rem; }
  .ficha-subnav-ai { flex:0 0 auto; align-self:center; margin-left:auto; }
}

/* Office workspace below the operational summary. */
.ficha-info-card,
.ficha-office-sections .card,
.ficha-3col .card {
  border: 1px solid color-mix(in srgb, var(--border-color) 88%, var(--neutral-300)) !important;
  border-radius: 18px !important;
  background: var(--bg-card);
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.045);
}

.ficha-info-card {
  overflow: hidden;
  padding: 1rem !important;
  margin-bottom: 0.75rem;
  border-top: 3px solid var(--primary) !important;
}

.ficha-info-card > div:first-child {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.ficha-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.ficha-info-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.ficha-info-editing-state {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary-soft) 72%, white);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 750;
}

.ficha-info-editing-state::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: '';
}

.ficha-info-card .info-section-grid {
  gap: 1px !important;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-soft);
}

@media (min-width: 1200px) {
  .ficha-info-card .info-section-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

.ficha-info-card .info-section-grid > div,
.ficha-info-card .info-section-grid > a {
  min-height: 76px;
  margin: 0 !important;
  padding: 0.75rem 0.85rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--bg-card) !important;
  transition: background 140ms ease;
}

.ficha-info-card .info-section-grid > div:hover,
.ficha-info-card .info-section-grid > a:hover {
  background: color-mix(in srgb, var(--primary-soft) 38%, var(--bg-card)) !important;
}

/* Editar conserva exactamente la misma geografía y jerarquía que el resumen. */
.ficha-info-card .ficha-info-edit-grid {
  gap: 1px !important;
  background: var(--border-color);
}

.ficha-info-card .ficha-info-edit-grid > * {
  border: 0 !important;
}

.ficha-info-edit-grid .form-label {
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.ficha-info-edit-grid .form-input {
  min-height: 38px;
  background: var(--bg-card);
}

.ficha-info-edit-grid .form-input:focus {
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.ficha-info-edit-grid .ficha-info-readonly {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: color-mix(in srgb, var(--bg-soft) 65%, var(--bg-card)) !important;
}

.ficha-info-edit-grid .field-reference { order: 1; }
.ficha-info-edit-grid .field-claim-number { order: 2; }
.ficha-info-edit-grid .field-claim-type { order: 3; }
.ficha-info-edit-grid .field-insured { order: 4; }
.ficha-info-edit-grid .field-company { order: 5; }
.ficha-info-edit-grid .field-policy { order: 6; }
.ficha-info-edit-grid .field-address { order: 7; }
.ficha-info-edit-grid .field-town { order: 8; }
.ficha-info-edit-grid .field-postcode { order: 9; }
.ficha-info-edit-grid .field-phone { order: 10; }
.ficha-info-edit-grid .field-email { order: 11; }
.ficha-info-edit-grid .field-assignee { order: 12; }
.ficha-info-edit-grid .field-created-date { order: 13; }
.ficha-info-edit-grid .field-notice-date { order: 14; }
.ficha-info-edit-grid .field-loss-date { order: 15; }
.ficha-info-edit-grid .field-next-action { order: 16; }
.ficha-info-edit-grid .field-deadline { order: 17; }
.ficha-info-edit-grid .field-deadline-days { order: 18; }
.ficha-info-edit-grid .field-deadline-status {
  order: 19;
  grid-column: 1 / -1;
}

.ficha-info-edit-grid .field-vehicle { order: 20; }

.ficha-info-inline-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 38px;
}

.ficha-info-inline-action strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-main);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ficha-info-inline-action .btn {
  min-height: 34px;
  padding: 0.4rem 0.7rem;
  flex-shrink: 0;
}

.ficha-info-card .ficha-info-deadline-status {
  grid-column: 1 / -1;
  min-height: 62px;
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--bg-card)) !important;
}

.ficha-office-sections {
  overflow: visible;
}

.ficha-office-sections .ficha-mod > .card,
.ficha-office-sections .ficha-mod > section {
  overflow: hidden;
  border-left: 1px solid var(--border-color) !important;
  border-top: 3px solid var(--mod-accent, var(--border-color)) !important;
}

.ficha-module-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.ficha-work-photos-card {
  overflow: hidden;
  border-color: color-mix(in srgb, #0ea5e9 20%, var(--border-color)) !important;
  border-top-color: #0ea5e9 !important;
  background:
    radial-gradient(circle at 96% 0%, rgba(14, 165, 233, 0.1), transparent 28%),
    var(--bg-card) !important;
}

.ficha-work-photos-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #0369a1;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.ficha-operational-core {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, #0f766e 16%, var(--border-color));
  border-radius: 19px;
  background: var(--bg-card);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
}

.ficha-operational-core-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background:
    radial-gradient(circle at 90% 10%, rgba(45, 212, 191, 0.22), transparent 32%),
    linear-gradient(125deg, #103c50 0%, #0f5f63 100%);
  color: #fff;
  cursor: pointer;
  list-style: none;
}

.ficha-operational-core-heading::-webkit-details-marker { display: none; }

.ficha-operational-core-heading > div {
  display: grid;
  gap: 0.1rem;
}

.ficha-operational-core-heading > div:first-child > span {
  color: #99f6e4;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.ficha-operational-core-heading strong {
  font-size: 0.98rem;
  letter-spacing: -0.012em;
}

.ficha-operational-core-summary { display: flex !important; grid-auto-flow: column; align-items: center; justify-content: end; gap: 0.48rem !important; }
.ficha-operational-core-metrics { display: flex !important; align-items: stretch; gap: .4rem !important; margin-right: .25rem; }
.ficha-operational-core-metrics > span { display: flex; align-items:center; min-width: 132px; gap: .5rem; padding: .46rem .62rem; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.09); text-transform: none; }
.ficha-operational-core-metrics > span > svg { flex:0 0 auto; padding:.3rem; border-radius:8px; box-sizing:content-box; }
.ficha-operational-core-metrics > span > i { display:grid; gap:.04rem; min-width:0; font-style:normal; }
.ficha-operational-core-metrics > span.is-minute > svg { color:#c7d2fe; background:rgba(99,102,241,.28); }
.ficha-operational-core-metrics > span.is-payment > svg { color:#fde68a; background:rgba(245,158,11,.25); }
.ficha-operational-core-metrics > span.is-payment.is-done > svg { color:#bbf7d0; background:rgba(34,197,94,.24); }
.ficha-operational-core-metrics > span.is-professional > svg { color:#99f6e4; background:rgba(20,184,166,.25); }
.ficha-operational-core-metrics small { color: #ccfbf1; font-size: .61rem; font-weight: 600; letter-spacing: 0; line-height: 1.2; white-space: nowrap; }
.ficha-operational-core-metrics strong { color: #fff; font-size: .78rem; font-weight: 750; line-height: 1.25; letter-spacing: 0; white-space: nowrap; }
.ficha-operational-core-metrics strong.is-positive { color: #bbf7d0; }
.ficha-operational-core-summary > span:not(.ficha-operational-core-action) { padding: 0.38rem 0.62rem; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: #e2e8f0; background: rgba(255,255,255,.09); font-size: 0.7rem; font-weight: 650; line-height: 1.2; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.ficha-operational-core-summary > span.is-complete { color: #bbf7d0; border-color: rgba(134,239,172,.38); background: rgba(22,163,74,.22); }
.ficha-operational-core-summary > span.is-pending { color: #fde68a; border-color: rgba(253,230,138,.36); background: rgba(217,119,6,.22); }
.ficha-operational-core-summary > span.is-ready { color: #bfdbfe; border-color: rgba(147,197,253,.38); background: rgba(37,99,235,.2); }
.ficha-operational-core-action { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: 0.2rem; padding: .4rem .2rem; color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.ficha-operational-core-action svg { transition: transform 160ms ease; }
.ficha-operational-core[open] .ficha-operational-core-action svg { transform: rotate(180deg); }

.ficha-operational-core-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 0.85rem;
  padding: 0.85rem;
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.52), rgba(248, 250, 252, 0.65));
}

@media (min-width: 1320px) {
  .ficha-operational-core-grid {
    grid-template-columns: minmax(290px, 0.62fr) minmax(0, 1.7fr);
  }
}

.ficha-operational-core-grid > .card {
  height: auto;
  margin: 0 !important;
  border-radius: 15px !important;
  box-shadow: none;
}

.ficha-economy-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.ficha-economy-column {
  display: grid;
  align-content: start;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 13px;
  background: color-mix(in srgb, var(--bg-card) 86%, #f8fafc);
}

.ficha-economy-column-heading {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.15rem;
}

.ficha-economy-column-heading span {
  display:inline-flex;
  align-items:center;
  gap:.3rem;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.ficha-economy-column.is-secondary .ficha-economy-column-heading span {
  background: #ccfbf1;
  color: #0f766e;
}

.ficha-economy-column-heading strong {
  color: var(--text-main);
  font-size: 0.78rem;
}

.ficha-economy-column.is-primary {
  border-top: 2px solid #6366f1;
}

.ficha-economy-column.is-secondary {
  border-top: 2px solid #0d9488;
}

.ficha-economy-divider {
  height: 1px;
  background: var(--border-color);
}

.ficha-economy-billing-title {
  color: #0f766e;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.perito-workflow {
  position: relative;
  display: grid;
  gap: 0.9rem;
  margin-bottom: 0.75rem;
  padding: 1.05rem 1.15rem 0.85rem;
  overflow: hidden;
  border: 1px solid #b8d9d5;
  border-radius: 18px;
  background:
    radial-gradient(circle at 94% 0%, rgba(31, 147, 136, 0.18), transparent 30%),
    linear-gradient(135deg, #f8fcfb 0%, #eef8f6 100%);
  box-shadow: 0 12px 30px rgba(15, 73, 70, 0.08);
}

.perito-workflow-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}

.perito-workflow-head > div:first-child { min-width: 0; }

.perito-workflow-eyebrow {
  color: #0d7770;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.perito-workflow h2 {
  margin: 0.2rem 0 0.2rem;
  color: #12313b;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.15;
}

.perito-workflow p {
  margin: 0;
  color: #627585;
  font-size: 0.78rem;
  line-height: 1.45;
}

.perito-workflow-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.perito-workflow-actions .btn {
  min-height: 40px;
  border-radius: 10px;
  white-space: nowrap;
}

.perito-workflow-progress-label {
  display: grid;
  text-align: right;
}

.perito-workflow-progress-label strong {
  color: #0d7770;
  font-size: 1.2rem;
  line-height: 1;
}

.perito-workflow-progress-label span {
  margin-top: 0.15rem;
  color: #708591;
  font-size: 0.63rem;
  font-weight: 700;
}

.perito-workflow-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #d8e9e6;
}

.perito-workflow-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d7770, #23b39f);
  transition: width 300ms ease;
}

.perito-workflow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}

.perito-workflow-step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid #d9e5e5;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: #506570;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.perito-workflow-step:hover {
  transform: translateY(-1px);
  border-color: #8dc8c1;
  box-shadow: 0 5px 14px rgba(15, 73, 70, 0.07);
}

.perito-workflow-step > span:last-child {
  display: grid;
  min-width: 0;
}

.perito-workflow-step strong {
  overflow: hidden;
  color: #405662;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perito-workflow-step small {
  overflow: hidden;
  margin-top: 0.12rem;
  color: #8a9aa3;
  font-size: 0.61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perito-workflow-step-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 9px;
  background: #edf2f4;
  color: #70828d;
}

.perito-workflow-step.is-done {
  border-color: #c8e7da;
  background: #f3fbf7;
}

.perito-workflow-step.is-done .perito-workflow-step-icon {
  background: #dff5e9;
  color: #13845f;
}

.perito-workflow-step.is-active {
  border-color: #dfad58;
  background: #fffaf0;
  box-shadow: 0 0 0 2px rgba(223, 173, 88, 0.1);
}

.perito-workflow-step.is-active .perito-workflow-step-icon {
  background: #fff0cf;
  color: #b46d0e;
}

.perito-workflow-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(129, 174, 169, 0.3);
}

.perito-workflow-foot > div,
.perito-workflow-foot > button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #18765f;
  font-size: 0.7rem;
  font-weight: 750;
}

.perito-workflow-foot > div.has-alerts { color: #b45309; }
.perito-workflow-foot small {
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: #fff0cf;
}

.perito-workflow-foot > button {
  border: 0;
  background: transparent;
  color: #0d7770;
  cursor: pointer;
}

.ficha-evidence-purpose {
  margin-bottom: 0.55rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  background: #f0f9ff;
  color: #31566d;
  font-size: 0.73rem;
  line-height: 1.45;
}

.ficha-perito-whatsapp .card {
  border-top: 0 !important;
  box-shadow: none;
}

.ficha-peritacion-primary {
  border: 1px solid #bfdbfe !important;
  border-top: 4px solid #2563eb !important;
  background:
    radial-gradient(circle at 96% 0%, rgba(37, 99, 235, 0.11), transparent 25%),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 100%) !important;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.08) !important;
}

.ficha-peritacion-primary .peritacion-mode-grid > button {
  min-height: 104px;
  padding: 1rem !important;
}

@media (min-width: 769px) {
  .ficha-grid.ficha-perito-flow {
    grid-template-columns: minmax(0, 1.5fr) minmax(390px, 1fr);
  }

  .ficha-grid.ficha-perito-flow .ficha-right {
    grid-column: 1;
    grid-row: 1;
    position: static;
  }

  .ficha-grid.ficha-perito-flow .ficha-left {
    grid-column: 2;
    grid-row: 1;
    align-content: start;
  }

  .ficha-grid.ficha-perito-flow .ficha-evidence-tabs { grid-template-columns: 1fr; }
  .ficha-grid.ficha-perito-flow .ficha-evidence-tab { grid-template-columns: 38px minmax(0, 1fr) auto; padding-inline: .65rem; }

  .ficha-grid.ficha-peritacion-priority > #sec-peritación {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .ficha-grid.ficha-peritacion-priority > .ficha-right,
  .ficha-grid.ficha-peritacion-priority > .ficha-left {
    grid-row: 2;
  }

  .ficha-grid.ficha-perito-flow .ficha-mod-informe > .card {
    border: 1px solid #b7dcd5 !important;
    border-top: 4px solid #0d7770 !important;
    border-left: 1px solid #b7dcd5 !important;
    background:
      radial-gradient(circle at 98% 0%, rgba(13, 119, 112, 0.1), transparent 24%),
      var(--bg-card);
    box-shadow: 0 12px 30px rgba(15, 73, 70, 0.08);
  }

  .ficha-grid.ficha-perito-flow .ficha-left > div,
  .ficha-grid.ficha-perito-flow .ficha-right > div { min-width: 0; }
}

@media (min-width: 769px) and (max-width: 1180px) {
  .ficha-grid.ficha-perito-flow { grid-template-columns: minmax(0, 1fr); }
  .ficha-grid.ficha-peritacion-priority > #sec-peritación { grid-column: 1; grid-row: 1; }
  .ficha-grid.ficha-peritacion-priority > .ficha-right { grid-column: 1; grid-row: 2; }
  .ficha-grid.ficha-peritacion-priority > .ficha-left { grid-column: 1; grid-row: 3; }
}

@media (max-width: 768px) {
  .ficha-grid.ficha-peritacion-priority > #sec-peritación {
    grid-column: 1;
    grid-row: 1;
  }

  .ficha-grid.ficha-peritacion-priority > .ficha-right {
    grid-column: 1;
    grid-row: 2;
  }

  .ficha-grid.ficha-peritacion-priority > .ficha-left {
    grid-column: 1;
    grid-row: 3;
  }
}

@media (max-width: 920px) {
  .perito-workflow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .perito-workflow-step:last-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .perito-workflow { padding: 0.9rem; }
  .perito-workflow-head { display: grid; }
  .perito-workflow-actions { justify-content: space-between; }
  .perito-workflow-actions .btn { flex: 1; justify-content: center; }
  .perito-workflow-progress-label { text-align: left; }
  .perito-workflow-steps { grid-template-columns: 1fr; }
  .perito-workflow-step:last-child { grid-column: auto; }
  .perito-workflow-foot { align-items: flex-start; flex-direction: column; }

  .ficha-grid.ficha-perito-flow .ficha-right {
    grid-column: 1;
    grid-row: 1;
  }

  .ficha-grid.ficha-perito-flow .ficha-left {
    grid-column: 1;
    grid-row: 2;
  }
}

.operational-summary-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 0.9fr) minmax(245px, 1.1fr) minmax(280px, 1.35fr);
  gap: 1rem;
  align-items: stretch;
}
/* Vista de gestión: Responsable y Fotografías a mitades, y Alertas a todo
   el ancho con los avisos en fila — sin huecos posibles. */
.operational-summary-card.is-manager .operational-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.operational-summary-card.is-manager .operational-summary-item.is-alerts { grid-column: 1 / -1; }
.operational-alert-list { display: flex; flex-direction: column; gap: 0.28rem; }
.operational-summary-card.is-manager .operational-alert-list { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }

.operational-summary-grid > div {
  min-width: 0;
}

.operational-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: flex-start;
}

.operational-phone-action {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 0.3rem;
}

.operational-phone-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.3rem);
  left: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: max-content;
  padding: 0.48rem 0.55rem;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font-size: 0.76rem;
  font-weight: 750;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.14);
}

.operational-phone-popover button {
  border: 0;
  border-radius: 7px;
  padding: 0.24rem 0.42rem;
  background: #eff6ff;
  color: #1d4ed8;
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.trial-progress-summary {
  display: inline-grid;
  grid-template-columns: auto minmax(90px, 150px);
  align-items: center;
  gap: 0.55rem;
  min-width: 165px;
  white-space: nowrap;
}

.trial-progress-track {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.22);
}

.trial-progress-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  transition: width 0.25s ease;
}

.peritacion-preliminary-draft {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
  padding: 0.8rem;
  border: 1px solid #c4b5fd;
  border-radius: 12px;
  background: #faf5ff;
}

.peritacion-preliminary-draft textarea {
  min-height: 190px;
  resize: vertical;
  background: #fff;
}

@media (max-width: 640px) {
  .trial-progress-summary {
    grid-template-columns: auto minmax(72px, 1fr);
    width: min(100%, 210px);
  }
}

.operational-quick-action,
.operational-photo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 30px;
  padding: 0.3rem 0.58rem;
  border: 1px solid #dbe8f0;
  border-radius: 9px;
  background: #fff;
  color: #334155;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.operational-quick-action:hover,
.operational-photo-link:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.operational-management-summary {
  display: grid;
  gap: 0.45rem;
  font-size: 0.8rem;
}

.operational-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.operational-status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.2rem 0.48rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.66rem;
  font-weight: 800;
}

.operational-status-chip.is-success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.operational-status-chip.is-info { border-color: #bae6fd; background: #f0f9ff; color: #0369a1; }
.operational-status-chip.is-warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.operational-status-chip.is-danger { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }

.operational-photo-summary {
  min-width: 0;
  padding: 0 0.9rem;
  border-right: 1px solid #dbe8f0;
  border-left: 1px solid #dbe8f0;
}

.operational-photo-summary-body {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 0.85rem;
}

.operational-photo-count {
  display: grid;
  flex-shrink: 0;
  line-height: 1;
}

.operational-photo-count strong {
  color: #0369a1;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.operational-photo-count span {
  margin-top: 0.2rem;
  color: var(--neutral-500);
  font-size: 0.64rem;
}

.operational-photo-evidence {
  display: grid;
  min-width: 0;
  gap: 0.25rem;
}

.operational-photo-evidence small {
  color: var(--neutral-400);
  font-size: 0.64rem;
  line-height: 1.3;
}

.operational-photo-previews {
  display: flex;
  padding-left: 0.35rem;
}

.operational-photo-previews img {
  width: 38px;
  height: 38px;
  margin-left: -0.35rem;
  border: 2px solid #fff;
  border-radius: 9px;
  background: var(--bg-soft);
  object-fit: cover;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
}

.operational-photo-status {
  min-width: 0;
  color: var(--neutral-500);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.3;
}

.operational-photo-status.is-ready {
  color: #087f5b;
}

.operational-photo-link {
  margin-left: auto;
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: 8px;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.operational-photo-link:hover { background: #e0f2fe; }

@media (max-width: 1180px) {
  .operational-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operational-photo-summary {
    padding: 0;
    border: 0;
  }
}

.ficha-control.ficha-compact .ficha-activity-card {
  border-top-color: #f97316 !important;
  background:
    radial-gradient(circle at 96% 0%, rgba(249, 115, 22, 0.09), transparent 26%),
    var(--bg-card) !important;
}

.ficha-control.ficha-compact .ficha-activity-card .section-title {
  font-size: 1rem;
}

.ficha-control.ficha-compact .ficha-3col {
  margin-top: 0;
}

.ficha-control.ficha-compact .ficha-3col-cell.is-activity {
  grid-column: 1 / -1;
}

.ficha-messages-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem !important;
  background:
    radial-gradient(circle at 96% -5%, rgba(14, 165, 233, 0.11), transparent 30%),
    var(--bg-card) !important;
}

.ficha-message-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.ficha-message-header-copy { min-width: 0; }

/* PERSONAL · control horario */
.time-clock-header { position: relative; }
.time-clock-pill { min-height: 38px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-card); color: var(--neutral-700); padding: .45rem .75rem; display: inline-flex; align-items: center; gap: .45rem; font-size: .76rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.time-clock-pill strong { font-variant-numeric: tabular-nums; font-size: .72rem; }
.time-clock-pill.is-working { border-color: #86efac; background: #f0fdf4; color: #166534; }
.time-clock-pill.is-paused { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.time-clock-popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 900; width: min(330px, calc(100vw - 24px)); border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-card); box-shadow: 0 18px 45px rgba(15,23,42,.16); padding: 1rem; }
.time-clock-popover-title { font-weight: 800; color: var(--neutral-900); }
.time-clock-popover p { color: var(--neutral-500); font-size: .78rem; margin: .25rem 0 .8rem; }
.time-clock-popover > a { display: block; margin-top: .55rem; font-size: .76rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.time-clock-popover > a:hover { text-decoration: underline; }
.time-clock-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.time-clock-error,.personal-message { padding: .65rem .8rem; border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; border-radius: 9px; font-size: .76rem; margin: .6rem 0; }
.time-clock-reminder { display:flex; align-items:flex-start; gap:.4rem; padding:.6rem .7rem; border:1px solid #fde68a; background:#fffbeb; color:#92400e; border-radius:9px; font-size:.74rem; line-height:1.4; margin:.6rem 0; }
.time-clock-reminder > svg { flex:0 0 auto; margin-top:.05rem; }
.personal-page { max-width: 1280px; margin: 0 auto; }
.personal-page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.personal-eyebrow { color: var(--primary); font-size: .66rem; letter-spacing: .12em; font-weight: 900; }
.personal-live { display: inline-flex; gap: .45rem; align-items: center; font-size: .75rem; font-weight: 700; padding: .45rem .75rem; border-radius: 999px; background: var(--bg-card); border: 1px solid var(--border-color); }
.personal-live span { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.personal-live.is-working span { background: #22c55e; box-shadow: 0 0 0 4px #dcfce7; }
.personal-live.is-paused span { background: #f59e0b; box-shadow: 0 0 0 4px #fef3c7; }
.personal-tabs { display: flex; gap: .35rem; border-bottom: 1px solid var(--border-color); overflow-x: auto; }
.personal-tabs button { display: inline-flex; align-items: center; gap: .4rem; padding: .65rem .8rem; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--neutral-500); font-weight: 700; white-space: nowrap; }
.personal-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.personal-tabs b { background: #fee2e2; color: #b91c1c; min-width: 18px; height: 18px; border-radius: 99px; display: inline-grid; place-items: center; font-size: .65rem; }
.personal-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: .75rem; }
.personal-stat { border: 1px solid var(--border-color); background: var(--bg-card); border-radius: 14px; padding: 1rem; display: grid; gap: .35rem; }
.personal-stat span { color: var(--neutral-500); font-size: .72rem; }
.personal-stat strong { color: var(--neutral-900); font-size: 1.25rem; }
.personal-stat.accent { background: linear-gradient(135deg,#eff6ff,#fff); border-color: #bfdbfe; }
.personal-stat.warning { background: #fffbeb; border-color: #fde68a; }
.personal-history { padding: 0; overflow: hidden; }
.personal-history-head { padding: 1rem; display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; flex-wrap: wrap; border-bottom: 1px solid var(--border-color); }
.personal-history h2,.personal-section-head h2 { margin: 0; font-size: 1rem; color: var(--neutral-900); }
.personal-history p,.personal-section-head p { margin: .2rem 0 0; font-size: .76rem; color: var(--neutral-500); }
.personal-filters { display: flex; flex-wrap: wrap; gap: .45rem; }
.personal-filters input,.personal-inline-field input { border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); color: var(--neutral-800); padding: .48rem .6rem; }
.personal-table-wrap { overflow-x: auto; }
.personal-table { border-collapse: collapse; width: 100%; min-width: 620px; }
.personal-table th { text-align: left; color: var(--neutral-400); font-size: .66rem; text-transform: uppercase; padding: .65rem 1rem; background: var(--bg-soft); }
.personal-table td { border-top: 1px solid var(--border-color); padding: .75rem 1rem; font-size: .78rem; color: var(--neutral-700); }
.personal-table td:nth-child(2) svg { vertical-align: middle; margin-right: .35rem; }
.personal-table small { display: block; color: var(--neutral-400); margin-top: .15rem; }
.personal-correct-link { display: block; border: 0; background: transparent; color: var(--primary); padding: .25rem 0 0; font-size: .68rem; font-weight: 700; }
.personal-empty { text-align: center; padding: 2rem !important; color: var(--neutral-400) !important; }
.personal-section-head { display: flex; gap: .7rem; margin-bottom: 1rem; }
.personal-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: #eff6ff; color: #2563eb; flex: 0 0 auto; }
.personal-settings { display: grid; gap: .85rem; }
.personal-toggle { display: flex; gap: .7rem; align-items: flex-start; background: var(--bg-soft); border: 1px solid var(--border-color); border-radius: 12px; padding: .85rem; }
.personal-toggle input,.personal-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.personal-toggle span { display: grid; gap: .15rem; }
.personal-toggle small { color: var(--neutral-500); }
.personal-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.personal-form-grid label,.personal-inline-field { display: grid; gap: .3rem; font-size: .72rem; font-weight: 700; color: var(--neutral-600); }
.personal-check { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }
.personal-legal-note { display: flex; align-items: center; gap: .5rem; padding: .65rem .8rem; background: #f0fdf4; color: #166534; border-radius: 9px; font-size: .75rem; }
.personal-settings > .btn { width: fit-content; }
.personal-people-list { display: grid; gap: .55rem; }
.personal-person,.personal-correction { display: flex; align-items: center; gap: .7rem; padding: .75rem; border: 1px solid var(--border-color); border-radius: 11px; }
.personal-person-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #eef2ff; color: #4338ca; font-weight: 800; }
.personal-person-copy { flex: 1; min-width: 140px; display: grid; }
.personal-person-copy small,.personal-correction small { color: var(--neutral-500); }
.personal-weekdays { display: flex; gap: .2rem; margin-top: .35rem; }
.personal-weekdays button { width: 24px; height: 24px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-card); color: var(--neutral-500); font-size: .64rem; }
.personal-weekdays button.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.personal-inline-field input { width: 90px; }
.personal-enable { min-height: 36px; border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8; border-radius: 9px; padding: .45rem .65rem; font-weight: 700; display: inline-flex; gap: .3rem; align-items: center; }
.personal-enable.enabled { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.personal-correction > div:first-child { flex: 1; }
.personal-correction p { margin: .15rem 0; font-size: .78rem; }
.personal-correction > div:last-child { display: flex; gap: .35rem; }
@media (max-width: 900px) { .personal-stats { grid-template-columns: repeat(2,1fr); } .personal-person { flex-wrap: wrap; } }
@media (max-width: 680px) { .time-clock-pill span { display: none; } .time-clock-pill { min-width: 44px; justify-content: center; } .time-clock-pill strong { display: none; } .personal-stats,.personal-form-grid { grid-template-columns: 1fr; } .personal-page-head { align-items: flex-start; } .personal-history-head { align-items: stretch; } .personal-filters input { flex: 1; min-width: 120px; } .personal-person-copy { flex-basis: calc(100% - 50px); } }

/* PERSONAL · Fase 2 · Vacaciones y ausencias */
.absence-settings-stack,.absence-page { display:grid; gap:1rem; }
.absence-type-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem; }
.absence-type-card { display:flex; align-items:center; gap:.65rem; text-align:left; padding:.75rem; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-card); color:var(--neutral-700); opacity:.62; }
.absence-type-card.active { opacity:1; border-color:#bfdbfe; background:linear-gradient(135deg,#f8fbff,#fff); }
.absence-type-card i { width:11px; height:36px; border-radius:99px; flex:0 0 auto; }
.absence-type-card span { flex:1; display:grid; gap:.18rem; }
.absence-type-card small { color:var(--neutral-500); }
.absence-type-card b { font-size:.68rem; color:var(--primary); }
.absence-holiday-form { display:grid; grid-template-columns:150px 1fr 150px auto; gap:.55rem; }
.absence-holidays { display:grid; gap:.35rem; margin-top:.75rem; }
.absence-holidays>div { display:flex; justify-content:space-between; align-items:center; padding:.45rem .65rem; background:var(--bg-soft); border-radius:9px; font-size:.76rem; }
.absence-modal-backdrop { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; padding:1rem; background:rgba(15,23,42,.52); backdrop-filter:blur(3px); }
.absence-modal { width:min(600px,100%); max-height:92vh; overflow:auto; display:grid; gap:.85rem; box-shadow:0 24px 70px rgba(15,23,42,.24); }
.absence-modal label { display:grid; gap:.3rem; font-size:.75rem; font-weight:750; color:var(--neutral-600); }
.absence-modal-head { display:flex; justify-content:space-between; gap:1rem; }
.absence-modal-head span { font-size:.62rem; font-weight:900; color:var(--primary); letter-spacing:.12em; }
.absence-modal-head h2 { margin:.18rem 0 0; font-size:1.15rem; }
.absence-modal-head button { border:0; background:transparent; color:var(--neutral-500); }
.absence-date-grid { display:grid; grid-template-columns:1fr 1fr; gap:.65rem; }
.absence-calculation { display:grid; grid-template-columns:repeat(2,1fr); gap:.45rem; }
.absence-calculation>div { display:grid; gap:.15rem; padding:.65rem; background:var(--bg-soft); border:1px solid var(--border-color); border-radius:10px; }
.absence-calculation span { font-size:.66rem; color:var(--neutral-500); }
.absence-calculation strong { font-size:.82rem; }
.absence-calculation .accent { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
.absence-hint { color:#166534; background:#f0fdf4; padding:.55rem .65rem; border-radius:8px; }
.absence-modal-actions { display:flex; justify-content:flex-end; gap:.5rem; }
.absence-rule-grid { display:grid; grid-template-columns:1fr 1fr; gap:.55rem; padding:.7rem; border:1px solid var(--border-color); border-radius:10px; background:var(--bg-soft); }
.absence-request-list,.absence-approval-list,.absence-balance-list { display:grid; }
.absence-request-list article,.absence-approval-list article { display:flex; align-items:center; gap:.7rem; padding:.8rem 1rem; border-top:1px solid var(--border-color); }
.absence-request-list article>i { width:5px; height:42px; border-radius:9px; background:var(--primary); }
.absence-request-list article>div,.absence-approval-list article>div:nth-child(2) { flex:1; display:grid; gap:.2rem; }
.absence-request-list article span,.absence-approval-list article span { font-size:.75rem; color:var(--neutral-500); }
.absence-request-list article small,.absence-approval-list article small { color:var(--neutral-400); }
.absence-calendar-head { display:flex; justify-content:center; align-items:center; gap:1rem; margin-bottom:1rem; }
.absence-calendar-head h2 { min-width:220px; margin:0; text-align:center; text-transform:capitalize; font-size:1rem; }
.absence-calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(90px,1fr)); overflow-x:auto; }
.absence-calendar-grid>b { text-align:center; padding:.45rem; color:var(--neutral-400); font-size:.68rem; }
.absence-calendar-grid>div { min-height:92px; border:1px solid var(--border-color); margin:-1px 0 0 -1px; padding:.4rem; display:flex; flex-direction:column; gap:.25rem; }
.absence-calendar-grid>div>span { font-weight:800; font-size:.72rem; }
.absence-calendar-grid>div>small { color:#b45309; font-size:.62rem; }
.absence-calendar-grid>div>em { font-style:normal; background:#eff6ff; color:#1d4ed8; padding:.2rem .3rem; border-radius:5px; font-size:.6rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.absence-calendar-grid>div.holiday { background:#fffbeb; }
.absence-inline-actions { display:inline-flex; gap:.25rem; margin-left:.4rem; }
.absence-inline-actions button { border:0; background:transparent; color:var(--primary); font-size:.65rem; font-weight:750; }
.absence-balance-list article { display:grid; grid-template-columns:minmax(150px,1.5fr) repeat(5,minmax(80px,1fr)) auto auto; gap:.55rem; align-items:center; padding:.7rem; border-top:1px solid var(--border-color); font-size:.72rem; }
.absence-balance-list article>div { display:grid; }
.absence-balance-list small { color:var(--neutral-400); }
.absence-balance-list .available { color:#166534; background:#f0fdf4; padding:.4rem; border-radius:7px; }
.absence-today-note { display:flex; align-items:center; gap:.65rem; padding:.75rem .9rem; border:1px solid #bbf7d0; background:#f0fdf4; color:#166534; border-radius:12px; }
.absence-today-note div { display:grid; gap:.1rem; }
.absence-today-note span { font-size:.72rem; }
@media(max-width:900px){.absence-type-grid{grid-template-columns:1fr}.absence-holiday-form{grid-template-columns:1fr 1fr}.absence-balance-list article{grid-template-columns:1fr 1fr 1fr}.absence-calendar-grid{min-width:760px}}
@media(max-width:680px){.absence-date-grid,.absence-calculation,.absence-holiday-form,.absence-rule-grid{grid-template-columns:1fr}.absence-request-list article,.absence-approval-list article{flex-wrap:wrap}.absence-request-list article>div,.absence-approval-list article>div:nth-child(2){flex-basis:calc(100% - 55px)}.absence-balance-list article{grid-template-columns:1fr 1fr}.absence-modal{border-radius:16px}.absence-modal-actions .btn{flex:1}}

.ficha-message-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ficha-message-title-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid #bae6fd;
  border-radius: 11px;
  background: linear-gradient(145deg, #f0f9ff, #e0f2fe);
  color: #0284c7;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.1);
}

.ficha-message-channel {
  display: inline-flex;
  margin-top: 0.18rem;
  color: #0284c7;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.ficha-message-subtitle {
  max-width: 720px;
  margin: 0.45rem 0 0 3.05rem !important;
  line-height: 1.45;
}

.ficha-message-overview,
.ficha-message-delivery-summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.45rem 0 0 3.05rem;
}

.ficha-message-overview > span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 700;
}

.ficha-message-overview > span + span::before {
  content: '';
  width: 3px;
  height: 3px;
  margin-right: 0.15rem;
  border-radius: 50%;
  background: #94a3b8;
}

.ficha-message-timeline {
  min-height: 132px;
  padding: 0.45rem !important;
  border: 1px solid color-mix(in srgb, #0ea5e9 18%, var(--border-color));
  border-radius: 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    radial-gradient(circle at 1px 1px, rgba(14, 165, 233, 0.11) 1px, transparent 0);
  background-size: auto, 18px 18px;
  scrollbar-width: thin;
}

.ficha-message-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  color: #64748b;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: capitalize;
}

.ficha-message-day::before {
  content: '';
  position: absolute;
  right: 0.6rem;
  left: 0.6rem;
  height: 1px;
  background: #e2e8f0;
}

.ficha-message-day span {
  position: relative;
  z-index: 1;
  padding: 0.22rem 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
}

.ficha-message-event {
  --message-accent: #64748b;
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0.35rem;
}

.ficha-message-event.is-mine { --message-accent: #2563eb; }
.ficha-message-event.is-urgent { --message-accent: #dc2626; }
.ficha-message-event.is-unread { --message-accent: #0284c7; }

.ficha-message-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.ficha-message-rail::after {
  content: '';
  position: absolute;
  top: 20px;
  bottom: -0.65rem;
  width: 2px;
  background: #dbe4ef;
}

.ficha-message-event:last-child .ficha-message-rail::after { display: none; }

.ficha-message-rail span {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--message-accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--message-accent) 35%, #cbd5e1);
}

.ficha-message-bubble {
  position: relative;
  min-width: 0;
  padding: 0.72rem 0.85rem 0.65rem;
  border: 1px solid #dbe4ef;
  border-left: 3px solid var(--message-accent);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f2937;
  cursor: pointer;
  outline: none;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.ficha-message-event.is-mine .ficha-message-bubble { background: linear-gradient(110deg, #f8fbff, #eff6ff); }
.ficha-message-event.is-urgent .ficha-message-bubble { background: linear-gradient(110deg, #fff, #fef2f2); }
.ficha-message-event.is-unread .ficha-message-bubble { border-color: #7dd3fc; background: linear-gradient(110deg, #fff, #f0f9ff); }

.ficha-message-bubble:hover {
  transform: translateY(-1px);
  filter: brightness(0.99);
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.1);
}

.ficha-message-bubble:focus-visible {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.22), 0 7px 18px rgba(15, 23, 42, 0.1);
}

.ficha-message-bubble-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  margin-bottom: 0.5rem;
}

.ficha-message-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex: 0 0 30px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--message-accent) 11%, #fff);
  color: var(--message-accent);
  font-size: 0.72rem;
  font-weight: 900;
}

.ficha-message-author {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex-wrap: wrap;
}

.ficha-message-author strong { color: #0f172a; font-size: 0.76rem; }

.ficha-message-type,
.ficha-message-priority {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.13rem 0.42rem;
  border: 1px solid #ddd6fe;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  font-size: 0.6rem;
  font-weight: 800;
}

.ficha-message-type.is-consulta { border-color: #bae6fd; background: #f0f9ff; color: #0369a1; }
.ficha-message-type.is-respuesta { border-color: #e2e8f0; background: #f8fafc; color: #475569; }
.ficha-message-priority { margin-left: auto; border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.ficha-message-bubble-head time { margin-left: auto; color: #64748b; font-size: 0.66rem; font-weight: 750; white-space: nowrap; }
.ficha-message-priority + time { margin-left: 0; }

.ficha-message-text {
  padding-left: 2.55rem;
  color: #1e293b;
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ficha-message-unread-copy {
  display: grid;
  gap: 0.25rem;
  padding: 0.15rem 0 0.1rem 2.55rem;
  color: #64748b;
  font-size: 0.72rem;
}

.ficha-message-unread-copy strong,
.ficha-message-unread-copy span:last-child { display: inline-flex; align-items: center; gap: 0.35rem; }
.ficha-message-unread-copy strong { color: #0369a1; font-size: 0.82rem; }

.ficha-message-attachment {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.45rem 0 0 2.55rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.7rem;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.ficha-message-actions { margin: 0.45rem 0 0 2.55rem; }
.ficha-message-bubble > .ficha-message-read-receipt { margin-left: 2.55rem; }

.ficha-message-open-hint {
  position: absolute;
  right: 0.75rem;
  bottom: 0.55rem;
  color: #94a3b8;
  font-size: 0.6rem;
  font-weight: 750;
  opacity: 0;
  transition: opacity 150ms ease;
}

.ficha-message-bubble:hover .ficha-message-open-hint,
.ficha-message-bubble:focus-visible .ficha-message-open-hint { opacity: 1; }

.insurer-deadline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.message-detail {
  display: grid;
  gap: 1rem;
}

.message-detail-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.message-detail-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, #e0f2fe, #dbeafe);
  color: #0369a1;
  font-size: 0.86rem;
  font-weight: 850;
}

.message-detail-meta > div {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

.message-detail-meta strong {
  color: var(--text-main);
  font-size: 0.86rem;
}

.message-detail-meta span:not(.message-detail-avatar):not(.message-detail-urgent) {
  color: var(--neutral-500);
  font-size: 0.7rem;
}

.message-detail-urgent {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: auto;
  padding: 0.28rem 0.5rem;
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.message-detail-body {
  min-height: 96px;
  padding: 1rem;
  border: 1px solid #dbe7ef;
  border-radius: 14px;
  background: linear-gradient(145deg, #fbfdff, #f7fafc);
  color: #1e293b;
  font-size: 0.92rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-detail-files {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
  border: 1px solid #dbe7ef;
  border-radius: 14px;
  background: var(--bg-soft);
}

.message-detail-files-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #334155;
  font-size: 0.76rem;
}

.message-detail-files-title span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.64rem;
  font-weight: 800;
}

.message-detail-file-card,
.message-detail-linked-file {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 11px;
  background: var(--bg-card);
}

.message-detail-file-card {
  justify-content: space-between;
}

.message-detail-file-card > div,
.message-detail-linked-file > span {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.6rem;
}

.message-detail-file-card > div > span,
.message-detail-linked-file > span {
  display: grid;
  gap: 0.08rem;
  text-align: left;
}

.message-detail-file-card strong,
.message-detail-linked-file strong {
  overflow: hidden;
  color: var(--text-main);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-detail-file-card small,
.message-detail-linked-file small {
  color: var(--neutral-500);
  font-size: 0.64rem;
}

.message-detail-linked-file {
  color: #0369a1;
  cursor: pointer;
  text-align: left;
}

.message-detail-linked-file > svg:last-child { margin-left: auto; }

.message-detail-linked-file:hover {
  border-color: #7dd3fc;
  background: #f0f9ff;
}

.message-detail-preview {
  display: grid;
  max-height: 430px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: #e8eef4;
}

.message-detail-preview img {
  display: block;
  max-width: 100%;
  max-height: 430px;
  object-fit: contain;
}

.message-detail-preview.is-pdf { height: min(52vh, 480px); }
.message-detail-preview iframe { width: 100%; height: 100%; border: 0; }

.message-detail-preview-state,
.message-detail-no-files {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  color: var(--neutral-500);
  font-size: 0.72rem;
}

.message-detail-preview-state {
  justify-content: center;
  min-height: 80px;
}

/* INFORME GUIADO: mesa de trabajo a pantalla completa */
.report-workspace {
  position: fixed;
  inset: 0;
  /* Debe quedar por encima del modal desde el que gerencia abre un informe.
     Al cerrar la mesa de trabajo se vuelve al listado del modal. */
  z-index: 11000;
  display: grid;
  grid-template-rows: 68px 4px minmax(0, 1fr) 68px;
  overflow: hidden;
  background: #edf2f5;
  color: #142232;
}

.report-workspace-topbar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(280px, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 0 1.15rem;
  border-bottom: 1px solid #d7e0e7;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 12px rgba(15, 35, 50, 0.05);
}

.report-workspace-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #466176;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
}

.report-workspace-back:hover { background: #eef5f7; color: #0b625d; }

.report-workspace-heading {
  display: grid;
  justify-items: center;
  gap: 0.08rem;
  text-align: center;
}

.report-workspace-heading span {
  color: #6e8292;
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.report-workspace-heading strong {
  color: #172536;
  font-size: 0.92rem;
}

.report-workspace-statuses {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  min-width: 0;
}

.report-save-state {
  overflow: hidden;
  color: #738393;
  font-size: 0.68rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-save-state.is-saved { color: #13795b; }
.report-save-state.is-error { color: #b42318; }

.report-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  flex-shrink: 0;
  padding: 0.28rem 0.5rem;
  border: 1px solid #f2d39a;
  border-radius: 999px;
  background: #fff8e8;
  color: #9a5b08;
  font-size: 0.64rem;
  font-weight: 850;
  text-transform: uppercase;
}

.report-status-badge.is-final,
.report-status-badge.is-reviewed {
  border-color: #b8e0cf;
  background: #edf9f4;
  color: #13795b;
}

.report-workspace-progress { background: #dce6ea; }
.report-workspace-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0d7770, #26a99d);
  transition: width 280ms ease;
}

.report-workspace-layout {
  display: grid;
  grid-template-columns: 260px minmax(460px, 1fr) 285px;
  min-height: 0;
  overflow: hidden;
}

.report-outline,
.report-context-panel,
.report-editor-main {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.report-outline {
  padding: 1rem 0.75rem 1.5rem;
  border-right: 1px solid #d5e0e5;
  background: #f8fafb;
}

.report-outline-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.18rem 0.5rem;
  margin: 0 0.25rem 1rem;
  padding: 0.75rem;
  border: 1px solid #cfe0df;
  border-radius: 12px;
  background: linear-gradient(145deg, #f2fbf9, #fff);
}

.report-outline-summary span {
  color: #597080;
  font-size: 0.67rem;
  font-weight: 700;
}

.report-outline-summary strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: #0d7770;
  font-size: 1.3rem;
  letter-spacing: -0.04em;
}

.report-outline-summary small {
  color: #82919d;
  font-size: 0.59rem;
}

.report-phase + .report-phase { margin-top: 1rem; }

.report-phase-title {
  display: block;
  padding: 0 0.55rem 0.35rem;
  color: #8494a1;
  font-size: 0.59rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-outline-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.48rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #4b6172;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 690;
  line-height: 1.28;
  text-align: left;
}

.report-outline-item:hover { background: #eef5f6; color: #244b53; }
.report-outline-item.is-active {
  border-color: #a8d3cf;
  background: #e8f7f4;
  color: #075e58;
  box-shadow: 0 4px 12px rgba(13, 119, 112, 0.08);
}

.report-outline-item > svg { color: #d08a20; }
.report-outline-item.is-complete > svg { color: #18956e; }

.report-outline-number {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 7px;
  background: #e9eef2;
  color: #6b7e8c;
  font-size: 0.61rem;
  font-weight: 850;
}

.report-outline-item.is-active .report-outline-number {
  background: #0d7770;
  color: #fff;
}

.report-editor-main {
  padding: 1.5rem clamp(1rem, 3vw, 3.2rem) 2rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.9), transparent 34%),
    #edf2f5;
}

.report-editor-alert,
.report-review-comment {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  max-width: 940px;
  margin: 0 auto 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #f1c9c5;
  border-radius: 10px;
  background: #fff3f2;
  color: #9f2d24;
  font-size: 0.74rem;
  font-weight: 650;
}

.report-review-comment {
  display: grid;
  border-color: #f0d7a6;
  background: #fff9eb;
  color: #8a570b;
}

.report-section-editor {
  max-width: 940px;
  min-height: calc(100% - 0.5rem);
  margin: 0 auto;
  padding: clamp(1.2rem, 2.5vw, 2.2rem);
  border: 1px solid #d8e1e8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(25, 48, 62, 0.08);
}

.report-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e9ee;
}

.report-section-heading > div { min-width: 0; }
.report-section-heading > div > span {
  color: #0d7770;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-section-heading h1 {
  margin: 0.25rem 0 0.38rem;
  color: #142232;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: -0.035em;
  line-height: 1.18;
}

.report-section-heading p {
  max-width: 690px;
  margin: 0;
  color: #627585;
  font-size: 0.78rem;
  line-height: 1.5;
}

.report-section-state {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  padding: 0.33rem 0.52rem;
  border: 1px solid #dbe3e8;
  border-radius: 999px;
  background: #f7f9fa;
  color: #667987;
  font-size: 0.64rem;
  font-weight: 800;
}

.report-section-state.is-complete {
  border-color: #b9e0cf;
  background: #effaf5;
  color: #13795b;
}

.report-fields {
  display: grid;
  gap: 1.15rem;
}

.report-fields.is-header-data {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.report-field { min-width: 0; margin: 0 !important; }
.report-field-label {
  display: flex !important;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.38rem !important;
  color: #40566a !important;
  font-size: 0.72rem !important;
}

.report-auto-badge {
  margin-left: auto;
  padding: 0.1rem 0.35rem;
  border: 1px solid #bce2d2;
  border-radius: 999px;
  background: #effaf5;
  color: #13795b;
  font-size: 0.56rem;
  font-weight: 850;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.report-field-help {
  margin: -0.12rem 0 0.42rem;
  color: #7d8e9b;
  font-size: 0.68rem;
  line-height: 1.45;
}

.report-field .form-input {
  border-color: #d5e0e7;
  border-radius: 10px;
  background: #fcfdfe;
  font-size: 0.82rem;
}

.report-field .form-input:focus {
  border-color: #4ba79f;
  box-shadow: 0 0 0 3px rgba(13, 119, 112, 0.12);
}

.report-field .form-input:disabled {
  opacity: 1;
  background: #f4f7f8;
  color: #516474;
}

.report-fields:not(.is-header-data) .report-field.is-date,
.report-fields:not(.is-header-data) .report-field.is-select {
  max-width: 340px;
}

.report-narrative-input {
  min-height: 210px !important;
  padding: 0.9rem 1rem !important;
  resize: vertical;
  color: #273746;
  font-size: 0.88rem !important;
  line-height: 1.65;
}

.report-context-panel {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding: 1rem 0.85rem 1.5rem;
  border-left: 1px solid #d5e0e5;
  background: #f8fafb;
}

.report-context-panel section {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid #dce5ea;
  border-radius: 12px;
  background: #fff;
}

.report-context-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #294658;
  font-size: 0.7rem;
  font-weight: 850;
}

.report-context-title svg { color: #0d7770; }
.report-context-panel p {
  margin: 0;
  color: #6e808e;
  font-size: 0.68rem;
  line-height: 1.5;
}

.report-context-ok,
.report-missing-list span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #13795b;
  font-size: 0.67rem;
  font-weight: 700;
}

.report-missing-list { display: grid; gap: 0.35rem; }
.report-missing-list span { color: #a7670c; }

.report-evidence-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.report-evidence-counts span {
  display: grid;
  gap: 0.08rem;
  padding: 0.5rem;
  border-radius: 9px;
  background: #eef6f6;
  color: #657985;
  font-size: 0.6rem;
}

.report-evidence-counts strong { color: #0d7770; font-size: 1rem; }

.report-context-docs { display: grid; gap: 0.3rem; }
.report-context-docs span {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  min-width: 0;
  overflow: hidden;
  color: #526878;
  font-size: 0.63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-context-docs small { color: #8897a3; font-size: 0.6rem; }

.report-workspace-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.15rem;
  border-top: 1px solid #d5e0e5;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -4px 16px rgba(15, 35, 50, 0.055);
}

.report-footer-navigation,
.report-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.report-workspace-footer .btn { min-height: 38px; font-size: 0.74rem; }

.report-table-editor,
.report-photo-picker { display: grid; gap: 0.55rem; }
.report-table-scroll {
  overflow-x: auto;
  border: 1px solid #dce5ea;
  border-radius: 11px;
}
.report-data-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.report-table-actions { display: flex; align-items: center; gap: 0.6rem; }
.report-photo-options { display: flex; gap: 0.4rem; flex-wrap: wrap; }

@media (max-width: 1120px) {
  .report-workspace-layout { grid-template-columns: 235px minmax(0, 1fr); }
  .report-context-panel { display: none; }
}

@media (max-width: 760px) {
  .report-workspace { grid-template-rows: auto 4px minmax(0, 1fr) auto; }
  .report-workspace-topbar {
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
  }
  .report-workspace-heading { display: none; }
  .report-save-state { display: none; }
  .report-workspace-layout {
    display: flex;
    overflow-y: auto;
    flex-direction: column;
  }
  .report-outline {
    flex: 0 0 auto;
    overflow: visible;
    padding: 0.65rem;
    border-right: 0;
    border-bottom: 1px solid #d5e0e5;
  }
  .report-outline-summary { display: none; }
  .report-outline nav { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.2rem; }
  .report-phase { display: contents; }
  .report-phase-title { display: none; }
  .report-outline-item {
    display: flex;
    width: auto;
    min-width: max-content;
    padding-right: 0.65rem;
  }
  .report-editor-main { overflow: visible; padding: 0.75rem; }
  .report-section-editor { min-height: 0; padding: 1rem; border-radius: 14px; }
  .report-section-heading { align-items: flex-start; flex-direction: column; margin-bottom: 1rem; }
  .report-fields.is-header-data { grid-template-columns: 1fr; }
  .report-workspace-footer { align-items: stretch; padding: 0.6rem; flex-direction: column; }
  .report-footer-navigation,
  .report-footer-actions { width: 100%; overflow-x: auto; }
  .report-footer-navigation .btn { flex: 1; justify-content: center; }
  .report-footer-actions .btn { flex: 0 0 auto; }
}

@media (max-width: 600px) {
  .message-detail-file-card {
    align-items: stretch;
    flex-direction: column;
  }

  .message-detail-file-card .btn {
    justify-content: center;
    width: 100%;
  }

  .message-detail-preview.is-pdf { height: 44vh; }
}

.ficha-message-empty {
  display: flex;
  min-height: 116px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  color: var(--neutral-500);
  text-align: center;
}

.ficha-message-empty-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 0.15rem;
  place-items: center;
  border: 1px solid #bae6fd;
  border-radius: 15px;
  background: rgba(240, 249, 255, 0.92);
  color: #0284c7;
}

.ficha-message-empty strong {
  color: var(--text-main);
  font-size: 0.88rem;
}

.ficha-message-empty > span:last-child {
  max-width: 520px;
  font-size: 0.76rem;
  line-height: 1.45;
}

.ficha-message-compose {
  min-width: 168px;
  min-height: 38px;
  justify-content: center;
  border-color: var(--primary);
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--primary) 20%, transparent);
}

.ficha-message-compose:hover {
  background: var(--primary-strong);
  color: #fff;
}

.ficha-message-compose.is-open {
  border-color: var(--border-color);
  background: rgba(255, 255, 255, 0.84);
  color: var(--neutral-600);
  box-shadow: none;
}

.ficha-message-compose.is-open:hover {
  background: var(--bg-soft);
  color: var(--text-main);
}

.ficha-message-editor {
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem;
  border: 1px solid color-mix(in srgb, #0ea5e9 17%, var(--border-color));
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 7px 22px rgba(15, 23, 42, 0.045);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ficha-message-editor.is-modal {
  padding: 0;
  border: 0;
  box-shadow: none;
}

.ficha-message-editor.is-dragging {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}

.ficha-message-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ficha-message-editor-heading > div {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.ficha-message-editor-heading strong {
  color: var(--text-main);
  font-size: 0.82rem;
}

.ficha-message-editor-heading span {
  color: var(--neutral-500);
  font-size: 0.72rem;
}

.ficha-message-editor-heading kbd {
  padding: 0.22rem 0.45rem;
  border: 1px solid var(--border-color);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--neutral-500);
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 700;
}

.ficha-message-textarea {
  min-height: 92px;
  resize: vertical;
  border-color: color-mix(in srgb, #0ea5e9 15%, var(--border-color));
  background: #fff;
  line-height: 1.5;
}

.ficha-message-file {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  padding: 0.38rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 650;
}

.ficha-message-dropzone {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed #7dd3fc;
  border-radius: 12px;
  background: color-mix(in srgb, #f0f9ff 75%, #fff);
}

.ficha-message-dropzone-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex-shrink: 0;
  border-radius: 9px;
  background: #e0f2fe;
  color: #0369a1;
}

.ficha-message-dropzone-copy {
  display: grid;
  min-width: 0;
  gap: 0.08rem;
}

.ficha-message-dropzone-copy strong { color: #075985; font-size: 0.76rem; }
.ficha-message-dropzone-copy small { color: #64748b; font-size: 0.68rem; }

.ficha-message-file-picker {
  min-height: 34px;
  margin-left: auto;
  padding: 0.38rem 0.68rem;
  cursor: pointer;
  background: #fff;
  font-size: 0.72rem;
}

.ficha-message-editor-footer {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.ficha-note-types {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.ficha-note-types legend {
  width: 100%;
  margin-bottom: 0.42rem;
  color: #334155;
  font-size: 0.74rem;
  font-weight: 800;
}

.ficha-note-types legend span {
  margin-left: 0.35rem;
  color: #94a3b8;
  font-size: 0.66rem;
  font-weight: 600;
}

.ficha-note-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.42rem;
}

.ficha-note-type {
  display: flex;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  gap: 0.42rem;
  padding: 0.48rem 0.58rem;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.ficha-note-type:hover { border-color: #93c5fd; background: #f8fbff; }
.ficha-note-type > span { display: grid; min-width: 0; gap: 0.08rem; }
.ficha-note-type strong { color: inherit; font-size: 0.72rem; line-height: 1.15; }
.ficha-note-type small { color: #b45309; font-size: 0.6rem; line-height: 1.2; }
.ficha-note-type.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}
.ficha-note-type.is-priority.is-selected { border-color: #f59e0b; background: #fffbeb; color: #b45309; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12); }

.ficha-note-priority-hint,
.ficha-message-read-receipt {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.68rem;
  font-weight: 750;
}

.ficha-note-priority-hint { color: #b45309; }
.ficha-message-read-receipt { margin-top: 0.38rem; color: inherit; opacity: 0.72; }

.ficha-message-urgent {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.38rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--neutral-600);
  font-size: 0.72rem;
  cursor: pointer;
}

.ficha-message-urgent input { accent-color: #dc2626; }
.ficha-message-urgent.is-active { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }

.ficha-message-send {
  min-width: 112px;
  min-height: 38px;
  margin-left: auto;
}

.ficha-close-card {
  align-content: start;
  align-self: start;
  padding: 1rem !important;
  background:
    radial-gradient(circle at 96% 0%, rgba(245, 158, 11, 0.07), transparent 24%),
    var(--bg-card) !important;
}

.ficha-close-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.ficha-close-status {
  min-width: 0;
  padding: 0.72rem 0.78rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

@media (max-width: 1180px) {
  .ficha-economy-content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ficha-close-card {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .ficha-close-status-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .ficha-economy-card-heading { align-items:flex-start; flex-direction:column; }
  .ficha-economy-card-heading small { text-align:left; }
  .ficha-economy-flow-switch { grid-template-columns:1fr; }
}

/* Conversación interna: resumen ligero en la ficha + panel lateral de trabajo. */
.ficha-conversation-summary {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 74px;
  padding: .7rem .8rem;
  border: 1px solid #ddd6fe;
  border-left: 4px solid #7c3aed;
  border-radius: 15px;
  background: linear-gradient(105deg, #faf5ff 0%, #fff 68%);
  box-shadow: 0 8px 22px rgba(76, 29, 149, .06);
}
.ficha-conversation-summary.has-pending {
  border-color: #c4b5fd;
  background: linear-gradient(105deg, #f5f3ff 0%, #fff 68%);
  box-shadow: 0 10px 28px rgba(109, 40, 217, .12);
}
.ficha-conversation-summary-main {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
  flex: 1;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.ficha-conversation-summary-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 12px;
  color: #6d28d9;
  background: #ede9fe;
}
.ficha-conversation-summary.has-pending .ficha-conversation-summary-icon {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  box-shadow: 0 7px 16px rgba(109, 40, 217, .25);
}
.ficha-conversation-summary-copy { display: grid; gap: .18rem; min-width: 0; }
.ficha-conversation-summary-copy strong { color: #1e1b4b; font-size: .84rem; }
.ficha-conversation-summary-copy small {
  overflow: hidden;
  color: #64748b;
  font-size: .7rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ficha-conversation-summary-meta {
  display: grid;
  gap: .12rem;
  flex: 0 0 auto;
  color: #6d28d9;
  font-size: .68rem;
  font-weight: 800;
  text-align: right;
}
.ficha-conversation-summary-meta small { color: #94a3b8; font-size: .62rem; font-weight: 600; }

.conversation-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
}
.conversation-drawer {
  display: flex;
  width: min(620px, 94vw);
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid #ddd6fe;
  background: #f8fafc;
  box-shadow: -24px 0 70px rgba(15, 23, 42, .22);
  animation: conversationDrawerIn .22s ease-out;
}
@keyframes conversationDrawerIn { from { transform: translateX(28px); opacity: .65; } to { transform: translateX(0); opacity: 1; } }
.conversation-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex: 0 0 auto;
  padding: 1rem 1.1rem;
  color: #fff;
  background: linear-gradient(135deg, #5b21b6, #7c3aed 66%, #8b5cf6);
}
.conversation-drawer-head > div { min-width: 0; }
.conversation-drawer-head span { font-size: .63rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; opacity: .78; }
.conversation-drawer-head h2 { overflow: hidden; margin: .2rem 0 .1rem; font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
.conversation-drawer-head p { overflow: hidden; margin: 0; font-size: .73rem; opacity: .82; text-overflow: ellipsis; white-space: nowrap; }
.conversation-drawer-head button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 38px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
}
.conversation-drawer-content {
  display: flex !important;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: .65rem;
  padding: .85rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #f8fafc !important;
  box-shadow: none !important;
}
.conversation-drawer-content .ficha-message-header { display: none; }
.conversation-drawer-content .ficha-message-timeline {
  min-height: 0;
  max-height: none !important;
  flex: 1;
  padding: .4rem .2rem !important;
}
.conversation-drawer-content .ficha-message-editor {
  flex: 0 0 auto;
  margin-top: 0;
  border-color: #c4b5fd;
  background: #fff;
  box-shadow: 0 -8px 24px rgba(76, 29, 149, .07);
}
@media (max-width: 680px) {
  .ficha-conversation-summary { align-items: stretch; flex-wrap: wrap; }
  .ficha-conversation-summary-main { flex-basis: 100%; }
  .ficha-conversation-summary-meta { display: none; }
  .ficha-conversation-summary > .btn { width: 100%; }
  .conversation-drawer { width: 100vw; }
  .conversation-drawer-content { padding: .6rem !important; }
}

/* Dashboard de gerencia · consultas del equipo que todavía necesitan respuesta. */
.manager-query-panel {
  overflow: hidden;
  border: 1px solid #ddd6fe;
  border-radius: 16px;
  background: linear-gradient(105deg, #faf5ff 0%, #fff 72%);
  box-shadow: 0 10px 28px rgba(76, 29, 149, .07);
}
.manager-query-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem .9rem;
  border-bottom: 1px solid #ede9fe;
}
.manager-query-panel > header > div { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.manager-query-icon { display: grid; width: 36px; height: 36px; place-items: center; flex: 0 0 36px; border-radius: 10px; color: #fff; background: linear-gradient(135deg,#7c3aed,#5b21b6); }
.manager-query-panel header small { color: #7c3aed; font-size: .59rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.manager-query-panel h2 { margin: .08rem 0 0; color: #1e1b4b; font-size: .9rem; }
.manager-query-panel header button { display: inline-flex; align-items: center; gap: .3rem; border: 0; background: transparent; color: #6d28d9; font-size: .69rem; font-weight: 800; cursor: pointer; }
.manager-query-list { display: grid; }
.manager-query-list > button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  padding: .7rem .9rem;
  border: 0;
  border-top: 1px solid #f1f5f9;
  background: rgba(255,255,255,.78);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.manager-query-list > button:first-child { border-top: 0; }
.manager-query-list > button:hover { background: #f5f3ff; }
.manager-query-avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; color: #6d28d9; background: #ede9fe; font-size: .68rem; font-weight: 900; }
.manager-query-copy { display: grid; gap: .15rem; min-width: 0; }
.manager-query-copy strong { overflow: hidden; color: #1e293b; font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.manager-query-copy strong small { color: #7c3aed; font-size: .65rem; }
.manager-query-copy > span { overflow: hidden; color: #64748b; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.manager-query-action { display: inline-flex; align-items: center; gap: .25rem; color: #6d28d9; font-size: .65rem; font-weight: 800; white-space: nowrap; }
@media (max-width: 680px) {
  .manager-query-panel > header { align-items: flex-start; }
  .manager-query-list > button { grid-template-columns: 34px minmax(0, 1fr); }
  .manager-query-action { grid-column: 2; }
}

.ficha-info-read-view {
  display: grid;
  gap: 0.65rem;
}

.ficha-info-primary-grid .ficha-info-deadline-status {
  grid-column: auto;
  min-height: 76px;
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--bg-card)) !important;
}

.ficha-info-complementary {
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-soft) 72%, var(--bg-card));
}

.ficha-info-complementary .ficha-info-complementary-grid { border: 0; border-radius: 0; }

.ficha-info-more-button svg { transition: transform 160ms ease; }
.ficha-info-more-button[aria-expanded='true'] svg { transform: rotate(180deg); }

.ficha-info-complete-address {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ficha-economy-card {
  border-top: 3px solid #059669 !important;
  background:
    radial-gradient(circle at 96% 0%, rgba(5, 150, 105, 0.08), transparent 28%),
    var(--bg-card) !important;
}

/* Compensaciones: una misma fuente economica, dos circuitos claramente separados. */
.economic-items-summary { display: grid; gap: .65rem; }
.economic-items-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.economic-items-eyebrow { color: #0f766e; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.economic-items-title { color: #0f172a; font-size: .86rem; font-weight: 800; margin-top: .08rem; }
.economic-add-button { border-color: #99f6e4; background: #f0fdfa; color: #0f766e; font-size: .76rem; font-weight: 800; }
.economic-items-empty { display: flex; align-items: center; gap: .55rem; min-height: 52px; padding: .65rem .75rem; border: 1px dashed #cbd5e1; border-radius: 11px; background: #f8fafc; color: #64748b; font-size: .76rem; }
.economic-items-list { display: grid; gap: .35rem; }
.economic-item-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto auto 28px; align-items: center; gap: .55rem; padding: .48rem .55rem; border: 1px solid #e2e8f0; border-radius: 11px; background: #fff; }
.economic-item-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: #0284c7; background: #e0f2fe; }
.economic-item-icon.is-reimbursable_expense { color: #c2410c; background: #fff7ed; }
.economic-item-icon.is-payroll_incentive { color: #047857; background: #ecfdf5; }
.economic-item-main, .economic-item-amount { display: grid; gap: .08rem; }
.economic-item-main strong, .economic-item-amount strong { color: #0f172a; font-size: .78rem; }
.economic-item-main span, .economic-item-amount span { color: #64748b; font-size: .66rem; }
.economic-item-amount { text-align: right; }
.economic-receipt-warning { display: inline-flex; align-items: center; gap: .2rem; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 999px; padding: .15rem .4rem; font-size: .63rem; font-weight: 800; }
.economic-item-delete { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; color: #ef4444; background: transparent; cursor: pointer; }
.economic-item-delete:hover { background: #fef2f2; }
.economic-items-totals { display: flex; justify-content: flex-end; gap: 1rem; flex-wrap: wrap; padding-top: .15rem; color: #64748b; font-size: .7rem; }
.economic-items-totals strong { margin-left: .25rem; color: #0f172a; }
.economic-items-totals .is-negative strong { color: #dc2626; }
.economic-item-form { display: grid; gap: .85rem; }
.economic-destination-notice { display: flex; gap: .7rem; align-items: center; padding: .75rem; border-radius: 12px; color: #0f766e; background: linear-gradient(135deg,#f0fdfa,#ecfeff); border: 1px solid #99f6e4; }
.economic-destination-notice div { display: grid; gap: .1rem; }
.economic-destination-notice strong { color: #134e4a; font-size: .82rem; }
.economic-destination-notice span { font-size: .7rem; }
.economic-amount-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .65rem; }
.economic-receipt-toggle { display: flex; align-items: center; gap: .45rem; color: #334155; font-size: .78rem; font-weight: 700; }
.economic-receipt-upload { display: flex; align-items: center; gap: .6rem; padding: .7rem; border: 1px dashed #7dd3fc; border-radius: 11px; color: #0369a1; background: #f0f9ff; cursor: pointer; }
.economic-receipt-upload div { display: grid; gap: .08rem; }
.economic-receipt-upload strong { color: #0c4a6e; font-size: .76rem; }
.economic-receipt-upload span { color: #64748b; font-size: .66rem; }
.economic-form-error { display: flex; align-items: center; gap: .4rem; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 9px; padding: .55rem .7rem; font-size: .75rem; font-weight: 700; }

.economic-relationship-card { display: grid; gap: .7rem; padding: .85rem; border: 1px solid #bae6fd; border-radius: 13px; background: linear-gradient(135deg,#f8fafc 0%,#f0f9ff 100%); }
.economic-relationship-copy { display: flex; align-items: center; gap: .65rem; }
.economic-relationship-copy > div { display: grid; gap: .1rem; flex: 1; }
.economic-relationship-copy strong { color: #0f172a; font-size: .82rem; }
.economic-relationship-copy span { color: #64748b; font-size: .69rem; }
.economic-relationship-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: #e0f2fe; color: #0369a1; }
.economic-relationship-badge { border-radius: 999px; padding: .25rem .55rem; font-size: .68rem !important; font-weight: 800; white-space: nowrap; }
.economic-relationship-badge.is-external { color: #1d4ed8; background: #dbeafe; }
.economic-relationship-badge.is-employee { color: #047857; background: #d1fae5; }
.economic-relationship-badge.is-missing { color: #b45309; background: #fef3c7; }
.economic-relationship-form { display: grid; grid-template-columns: 1.25fr .8fr .8fr .8fr 1.2fr auto; align-items: end; gap: .55rem; }
.economic-relationship-history { display: flex; gap: .35rem; flex-wrap: wrap; }
.economic-relationship-history span { padding: .2rem .45rem; border-radius: 7px; background: #fff; border: 1px solid #e2e8f0; color: #64748b; font-size: .65rem; }
.economic-employee-note { display: grid; gap: .15rem; padding: .75rem; border: 1px solid #a7f3d0; border-radius: 11px; background: #ecfdf5; color: #065f46; }
.economic-employee-note strong { font-size: .8rem; }
.economic-employee-note span { font-size: .7rem; }

/* Fase 3 - reglas por concepto, tarifas y modalidad */
.economic-modality-row { display: flex; align-items: center; gap: .55rem; padding: .55rem .75rem; border: 1px solid var(--border-color); border-radius: 11px; background: var(--bg-soft); }
.economic-modality-label { color: var(--neutral-500); font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.economic-modality-select { max-width: 240px; min-height: 34px; padding: .35rem .55rem; font-size: .78rem; }
.economic-modality-row strong { color: var(--neutral-800); font-size: .8rem; }
.economic-modality-inferred { color: var(--neutral-400); font-size: .68rem; font-style: italic; }
.economic-travel-warning { display: flex; align-items: center; gap: .45rem; padding: .55rem .75rem; border: 1px solid #fde68a; border-radius: 11px; background: #fffbeb; color: #b45309; font-size: .76rem; font-weight: 700; }
.economic-item-rule { display: block; color: var(--neutral-400); font-size: .66rem; }
.economic-item-row.is-main-fee { border-color: #bfdbfe; background: #eff6ff; }
.economic-item-icon.is-main_fee { color: #1d4ed8; background: #dbeafe; }
.economic-item-icon.is-travel_km, .economic-item-icon.is-travel_fixed, .economic-item-icon.is-travel_zone { color: #6d28d9; background: #ede9fe; }
.economic-rule-hint { display: flex; align-items: center; gap: .3rem; margin-top: .3rem; color: var(--neutral-500); font-size: .68rem; line-height: 1.35; }
.economic-rule-hint.is-warning { color: #b45309; }
:root[data-theme='dark'] .economic-travel-warning { border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.1); color: #fbbf24; }
:root[data-theme='dark'] .economic-item-row.is-main-fee { border-color: rgba(96,165,250,.3); background: rgba(96,165,250,.08); }
:root[data-theme='dark'] .economic-rule-hint { color: var(--neutral-400); }

.compensations-page { --comp-ink: #10243e; --comp-teal: #087f75; --comp-sand: #fff7ed; display: grid; gap: .85rem; }
.compensations-hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; min-height: 132px; padding: 1.35rem 1.5rem; border-radius: 20px; color: #fff; background: linear-gradient(118deg,#0f3554 0%,#0e5969 58%,#0f766e 100%); box-shadow: 0 18px 40px rgba(15,53,84,.14); }
.compensations-hero::after { content: ''; position: absolute; right: 7%; top: -80px; width: 260px; height: 260px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 40px rgba(255,255,255,.035),0 0 0 80px rgba(255,255,255,.025); }
.compensations-kicker { color: #99f6e4; font-size: .68rem; font-weight: 900; letter-spacing: .14em; }
.compensations-hero h1 { margin: .2rem 0 .15rem; color: #fff; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.65rem,2.4vw,2.25rem); letter-spacing: -.03em; }
.compensations-hero p { margin: 0; max-width: 660px; color: #d8f3f1; font-size: .84rem; }
.compensations-hero-mark { position: relative; z-index: 1; display: grid; justify-items: center; gap: .3rem; min-width: 112px; padding: .8rem; border: 1px solid rgba(255,255,255,.2); border-radius: 15px; background: rgba(255,255,255,.09); backdrop-filter: blur(8px); }
.compensations-hero-mark span { color: #ccfbf1; font-size: .62rem; font-weight: 800; text-transform: uppercase; }
.compensations-history-button { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .4rem; padding: .65rem .8rem; border: 1px solid rgba(255,255,255,.25); border-radius: 11px; color: #fff; background: rgba(255,255,255,.1); font-size: .72rem; font-weight: 800; cursor: pointer; backdrop-filter: blur(8px); }
.compensations-history-button:hover { background: rgba(255,255,255,.18); }
.compensation-start { display: grid; gap: .85rem; padding: 1rem; border: 1px solid #e2e8f0; border-radius: 17px; background: #fff; box-shadow: 0 12px 32px rgba(15,35,60,.05); }
.compensation-start-head { display: grid; gap: .08rem; }
.compensation-start-head > span { color: #0f766e; font-size: .62rem; font-weight: 900; letter-spacing: .1em; }
.compensation-start-head h2 { margin: 0; color: var(--comp-ink); font-family: Georgia, 'Times New Roman', serif; font-size: 1.25rem; }
.compensation-start-head p { margin: 0; color: #64748b; font-size: .73rem; }
.compensation-choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.compensation-choice { display: grid; grid-template-columns: 46px minmax(0,1fr) 130px; align-items: start; gap: .7rem; min-height: 178px; padding: .9rem; border: 1px solid #dbe4ea; border-radius: 16px; text-align: left; background: #fff; cursor: pointer; box-shadow: 0 6px 18px rgba(15,35,60,.04); transition: transform .16s ease,box-shadow .16s ease,border-color .16s ease; }
.compensation-choice:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(15,35,60,.09); }
.compensation-choice.is-external:hover { border-color: #93c5fd; }
.compensation-choice.is-payroll:hover { border-color: #6ee7b7; }
.compensation-choice-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; }
.compensation-choice.is-external .compensation-choice-icon { color: #1d4ed8; background: #eff6ff; }
.compensation-choice.is-payroll .compensation-choice-icon { color: #047857; background: #ecfdf5; }
.compensation-choice-copy { display: grid; gap: .16rem; }
.compensation-choice-copy small { color: #64748b; font-size: .58rem; font-weight: 900; letter-spacing: .07em; }
.compensation-choice-copy strong { color: var(--comp-ink); font-size: .94rem; }
.compensation-choice-copy p { margin: 0; color: #64748b; font-size: .7rem; line-height: 1.45; }
.compensation-choice-copy em { margin-top: .25rem; color: #475569; font-size: .67rem; font-style: normal; font-weight: 750; }
.compensation-choice-total { display: grid; justify-items: end; gap: .05rem; padding-left: .7rem; border-left: 1px solid #e2e8f0; }
.compensation-choice-total small { color: #64748b; font-size: .56rem; font-weight: 900; }
.compensation-choice-total strong { color: var(--comp-ink); font-size: 1.15rem; }
.compensation-choice-total span { color: #94a3b8; font-size: .64rem; }
.compensation-choice-cta { grid-column: 2/4; align-self: end; display: inline-flex; align-items: center; justify-content: space-between; gap: .4rem; padding-top: .55rem; border-top: 1px solid #e2e8f0; font-size: .71rem; font-weight: 850; }
.compensation-choice.is-external .compensation-choice-cta { color: #1d4ed8; }
.compensation-choice.is-payroll .compensation-choice-cta { color: #047857; }
.compensation-start-ok { display: flex; align-items: center; gap: .55rem; padding: .65rem .75rem; border: 1px solid #a7f3d0; border-radius: 11px; color: #047857; background: #ecfdf5; }
.compensation-start-ok > div { display: grid; gap: .05rem; }
.compensation-start-ok strong { color: #065f46; font-size: .76rem; }
.compensation-start-ok span { color: #047857; font-size: .67rem; }
.compensation-back { width: fit-content; display: inline-flex; align-items: center; gap: .3rem; padding: .25rem 0; border: 0; color: #64748b; background: transparent; font-size: .69rem; font-weight: 750; cursor: pointer; }
.compensation-back:hover { color: #0f766e; }
.compensation-guide { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .7rem; }
.compensation-guide > div { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; gap: .7rem; padding: .8rem .9rem; border: 1px solid #dbe4ea; border-radius: 15px; background: #fff; }
.compensation-guide > div > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; }
.compensation-guide > div > div { display: grid; gap: .08rem; }
.compensation-guide small { color: #64748b; font-size: .59rem; font-weight: 900; letter-spacing: .07em; }
.compensation-guide strong { color: var(--comp-ink); font-size: .82rem; }
.compensation-guide p { margin: 0; color: #64748b; font-size: .67rem; line-height: 1.4; }
.compensation-guide .is-external { border-top: 3px solid #3b82f6; }
.compensation-guide .is-external > span { color: #1d4ed8; background: #eff6ff; }
.compensation-guide .is-payroll { border-top: 3px solid #10b981; }
.compensation-guide .is-payroll > span { color: #047857; background: #ecfdf5; }
.compensation-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: .7rem; }
.compensation-stat { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: .7rem; min-height: 88px; padding: .75rem .85rem; border: 1px solid #e2e8f0; border-radius: 15px; text-align: left; background: #fff; cursor: pointer; transition: transform .16s ease,box-shadow .16s ease; }
.compensation-stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,35,60,.08); }
.compensation-stat > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; }
.compensation-stat > div { display: grid; gap: .05rem; }
.compensation-stat small { color: #64748b; font-size: .61rem; font-weight: 900; letter-spacing: .06em; }
.compensation-stat strong { color: var(--comp-ink); font-size: 1.25rem; }
.compensation-stat em { color: #64748b; font-size: .66rem; font-style: normal; }
.compensation-stat.is-pending > span { color: #c2410c; background: #fff7ed; }
.compensation-stat.is-external > span { color: #1d4ed8; background: #eff6ff; }
.compensation-stat.is-payroll > span { color: #047857; background: #ecfdf5; }
.compensation-tabs { display: flex; gap: .2rem; padding: .25rem; width: fit-content; max-width: 100%; overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
.compensation-tabs button { border: 0; border-radius: 9px; padding: .48rem .75rem; color: #64748b; background: transparent; font-size: .74rem; font-weight: 800; white-space: nowrap; cursor: pointer; }
.compensation-tabs button.active { color: #fff; background: var(--comp-ink); box-shadow: 0 4px 10px rgba(16,36,62,.16); }
.compensation-message { padding: .6rem .8rem; border: 1px solid #99f6e4; border-radius: 10px; color: #0f766e; background: #f0fdfa; font-size: .76rem; font-weight: 700; }
.compensation-receipt-alert { padding: .65rem .75rem; border: 1px solid #fde68a; border-radius: 10px; color: #92400e; background: #fffbeb; font-size: .72rem; font-weight: 700; }
.compensation-panel { display: grid; gap: .75rem; padding: 1rem; border: 1px solid #e2e8f0; border-radius: 16px; background: #fff; box-shadow: 0 10px 30px rgba(15,35,60,.045); }
.compensation-panel-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
.compensation-panel-head > div:first-child { display: grid; gap: .1rem; }
.compensation-panel-head span { color: #0f766e; font-size: .62rem; font-weight: 900; letter-spacing: .1em; }
.compensation-panel-head h2 { margin: 0; color: var(--comp-ink); font-family: Georgia, 'Times New Roman', serif; font-size: 1.15rem; }
.compensation-panel-head p { margin: 0; color: #64748b; font-size: .71rem; }
.compensation-items { display: grid; gap: .35rem; }
.compensation-item { display: grid; grid-template-columns: 36px minmax(160px,1.3fr) minmax(120px,.8fr) 90px 92px; align-items: center; gap: .65rem; padding: .55rem .65rem; border: 1px solid #e5e7eb; border-radius: 11px; background: #fff; }
.compensation-item-symbol { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #0e7490; background: #ecfeff; }
.compensation-item-copy,.compensation-item-exp { display: grid; gap: .08rem; min-width: 0; }
.compensation-item-copy strong,.compensation-item-exp strong { overflow: hidden; color: #172033; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.compensation-item-copy span,.compensation-item-exp span { color: #718096; font-size: .65rem; }
.compensation-item-destination span { display: inline-flex; justify-content: center; width: 100%; padding: .2rem .4rem; border-radius: 999px; color: #0f766e; background: #f0fdfa; font-size: .64rem; font-weight: 800; }
.compensation-item-value { text-align: right; color: var(--comp-ink); font-size: .82rem; }
.compensation-empty { min-height: 150px; display: grid; place-items: center; align-content: center; gap: .25rem; color: #94a3b8; border: 1px dashed #cbd5e1; border-radius: 13px; background: #f8fafc; }
.compensation-empty strong { color: #334155; font-size: .86rem; }
.compensation-empty span { font-size: .72rem; }
.compensation-empty.is-small { min-height: 75px; }
.compensation-payroll-layout { display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: .75rem; align-items: start; }
.compensation-period { display: grid; gap: .2rem; }
.compensation-period label { color: #64748b; font-size: .62rem; font-weight: 800; }
.compensation-period input { border: 1px solid #cbd5e1; border-radius: 9px; padding: .42rem .55rem; color: #172033; background: #fff; font: inherit; font-size: .74rem; font-weight: 700; }
.compensation-batch-action { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .75rem; border-radius: 12px; color: #fff; background: linear-gradient(110deg,#103b56,#0f766e); }
.compensation-batch-action > div { display: grid; }
.compensation-batch-action span { color: #a7f3d0; font-size: .64rem; }
.compensation-batch-action strong { font-size: 1.15rem; }
.compensation-batches { display: grid; gap: .55rem; padding: .85rem; border: 1px solid #dbe4ea; border-radius: 16px; background: #f8fafc; }
.compensation-batches.is-embedded { padding: 0; border: 0; background: transparent; }
.compensation-side-head { display: flex; align-items: center; gap: .55rem; color: #0f766e; }
.compensation-side-head div { display: grid; }
.compensation-side-head strong { color: var(--comp-ink); font-size: .8rem; }
.compensation-side-head span { color: #64748b; font-size: .65rem; }
.compensation-batch { display: grid; gap: .45rem; padding: .7rem; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
.compensation-batch > div:first-child { display: grid; grid-template-columns: 1fr auto; gap: .05rem .5rem; }
.compensation-batch small { color: #0f766e; font-size: .65rem; font-weight: 900; }
.compensation-batch strong { color: var(--comp-ink); font-size: .95rem; text-align: right; }
.compensation-batch > div:first-child span { grid-column: 1/-1; color: #64748b; font-size: .65rem; }
.compensation-batch-status { width: fit-content; padding: .18rem .45rem; border-radius: 999px; color: #92400e; background: #fef3c7; font-size: .62rem; font-weight: 800; }
.compensation-batch-status.is-approved,.compensation-batch-status.is-exported,.compensation-batch-status.is-processed { color: #047857; background: #d1fae5; }
.compensation-batch-buttons { display: flex; gap: .35rem; }
.compensation-batch-buttons button { display: inline-flex; align-items: center; justify-content: center; gap: .25rem; flex: 1; border: 1px solid #cbd5e1; border-radius: 8px; padding: .35rem; color: #334155; background: #fff; font-size: .65rem; font-weight: 800; cursor: pointer; }
.compensations-denied { padding: 1.5rem; color: #64748b; font-weight: 700; }

@media (max-width: 1050px) {
  .economic-relationship-form { grid-template-columns: repeat(3,1fr); }
  .compensation-payroll-layout { grid-template-columns: 1fr; }
  .compensation-choice-grid { grid-template-columns: 1fr; }
  .compensation-stats { grid-template-columns: 1fr 1fr; }
  .compensation-stat:last-child { grid-column: 1/-1; }
}

@media (max-width: 720px) {
  .economic-item-row { grid-template-columns: 32px minmax(0,1fr) auto; }
  .economic-receipt-warning { grid-column: 2/4; width: fit-content; }
  .economic-item-delete { grid-column: 3; grid-row: 1; }
  .economic-amount-grid,.economic-relationship-form { grid-template-columns: 1fr; }
  .economic-relationship-copy { align-items: flex-start; flex-wrap: wrap; }
  .economic-relationship-badge { margin-left: 42px; }
  .compensations-hero { align-items: flex-start; min-height: 160px; padding: 1.1rem; }
  .compensations-hero-mark { display: none; }
  .compensations-history-button { align-self: flex-end; }
  .compensation-guide { grid-template-columns: 1fr; }
  .compensation-stats { grid-template-columns: 1fr; }
  .compensation-stat:last-child { grid-column: auto; }
  .compensation-item { grid-template-columns: 34px minmax(0,1fr) auto; }
  .compensation-item-exp { grid-column: 2; }
  .compensation-item-destination { grid-column: 2; width: fit-content; }
  .compensation-item-value { grid-column: 3; grid-row: 1; }
  .compensation-choice { grid-template-columns: 42px minmax(0,1fr); }
  .compensation-choice-total { grid-column: 2; justify-items: start; padding: .55rem 0 0; border-left: 0; border-top: 1px solid #e2e8f0; }
  .compensation-choice-cta { grid-column: 2; }
  .compensation-panel-head,.compensation-batch-action { align-items: stretch; flex-direction: column; }
}

.ficha-documents-card,
.ficha-activity-card {
  padding: 1rem !important;
}

.ficha-documents-card {
  background:
    radial-gradient(circle at 96% 0%, rgba(139, 92, 246, 0.07), transparent 28%),
    var(--bg-card) !important;
}

.ficha-activity-card {
  background:
    radial-gradient(circle at 98% 0%, rgba(245, 158, 11, 0.07), transparent 24%),
    var(--bg-card) !important;
}

.ficha-activity-card > div:nth-child(2) {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem !important;
}

.ficha-activity-card > div:nth-child(2) > div {
  min-height: 62px;
  padding: 0.65rem 0.7rem !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 11px;
  background: color-mix(in srgb, var(--bg-soft) 48%, var(--bg-card));
}

.ficha-activity-item {
  display: grid !important;
  grid-template-columns: 22px 18px minmax(0, 1fr);
  align-items: start;
  gap: .42rem !important;
  transition: background .1s, border-color .1s;
}

.ficha-activity-order {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 6px;
  color: #92400e;
  background: #fef3c7;
  font-size: .62rem;
  font-weight: 850;
}

.ficha-activity-icon { display: grid; height: 20px; place-items: center; }

.ficha-activity-more {
  justify-self: center;
  margin-top: 0.75rem;
  color: var(--primary);
  font-weight: 750;
}

@media (min-width: 769px) {
  .ficha-grid.ficha-control {
    gap: 1rem;
  }

  .ficha-grid.ficha-control .ficha-left {
    gap: 1rem;
  }

  .ficha-grid.ficha-control .ficha-right {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    columns: auto;
    margin-top: 1rem;
  }

  .ficha-grid.ficha-control .ficha-right > * {
    grid-column: 1 / -1;
    column-span: none;
    margin: 0;
  }

  .ficha-grid.ficha-control .ficha-right > .ficha-mod-galeria {
    grid-column: 1 / 7;
  }

  .ficha-grid.ficha-control .ficha-right > .ficha-mod-gestionDocumental {
    grid-column: 7 / 13;
  }

  .ficha-grid.ficha-control .ficha-right > .ficha-mod-relacionados { grid-column: 1 / -1; }
  .ficha-grid.ficha-control .ficha-right > .ficha-mod-whatsapp { grid-column: span 6; }

  .ficha-grid.ficha-control .ficha-3col {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
    gap: 1rem;
  }

  .ficha-grid.ficha-control .ficha-3col-cell {
    display: block;
    height: auto;
  }

  .ficha-grid.ficha-control .ficha-3col-cell > * {
    overflow: visible;
  }

  .ficha-grid.ficha-control .ficha-3col-cell.is-economic { grid-column: 1 / 6; }
  .ficha-grid.ficha-control .ficha-3col-cell.is-documents { grid-column: 6 / 13; }
  .ficha-grid.ficha-control .ficha-3col.is-control-office .ficha-3col-cell.is-documents { grid-column: 1 / -1; }
  .ficha-grid.ficha-control .ficha-3col-cell.is-activity { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .ficha-info-card .info-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .ficha-operational-core-grid { grid-template-columns: minmax(0, 1fr); }
  .ficha-operational-core-summary { grid-auto-flow: row; justify-content: start; grid-template-columns: repeat(2, minmax(0, auto)); flex-wrap: wrap; }
  .ficha-operational-core-metrics { flex-basis: 100%; margin: 0 0 .25rem; }
  .ficha-operational-core-action { grid-column: 1 / -1; margin-left: 0; }
}

@media (max-width: 640px) {
  .insurer-deadline-grid { grid-template-columns: minmax(0, 1fr); }
  .ficha-info-card { padding: 0.7rem !important; }
  .ficha-info-header { align-items: stretch; flex-direction: column; }
  .ficha-info-actions { width: 100%; }
  .ficha-info-actions .btn { flex: 1; }
  .ficha-info-editing-state { display: none; }
  .ficha-info-card .info-section-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .ficha-info-card .info-section-grid > div,
  .ficha-info-card .info-section-grid > a {
    min-height: 66px;
  }
  .ficha-module-heading { align-items: stretch; flex-direction: column; }
  .ficha-message-header { align-items: stretch; flex-direction: column; }
  .ficha-message-subtitle { margin-left: 0 !important; }
  .ficha-message-overview,
  .ficha-message-delivery-summary { margin-left: 0; }
  .ficha-message-event { grid-template-columns: 18px minmax(0, 1fr); gap: 0.2rem; }
  .ficha-message-bubble { padding: 0.65rem; }
  .ficha-message-bubble-head { align-items: flex-start; }
  .ficha-message-avatar { display: none; }
  .ficha-message-author { display: grid; gap: 0.22rem; }
  .ficha-message-priority { margin-left: auto; }
  .ficha-message-text,
  .ficha-message-unread-copy { padding-left: 0; }
  .ficha-message-attachment,
  .ficha-message-actions,
  .ficha-message-bubble > .ficha-message-read-receipt { margin-left: 0; }
  .ficha-message-open-hint { display: none; }
  .ficha-message-compose { width: 100%; }
  .ficha-message-editor-heading kbd { display: none; }
  .ficha-message-dropzone { align-items: flex-start; flex-wrap: wrap; }
  .ficha-message-file-picker { width: 100%; margin-left: 0; justify-content: center; }
  .ficha-note-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ficha-message-send { flex: 1; }
  .ficha-operational-core-heading { align-items: flex-start; flex-direction: column; }
  .ficha-operational-core-summary { width: 100%; display: flex !important; flex-wrap: wrap; justify-content: flex-start; }
  .ficha-operational-core-action { margin-left: auto; }
  .ficha-operational-core-metrics { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .ficha-operational-core-metrics > span { min-width: 0; }
  .ficha-operational-core-grid { padding: 0.65rem; }
  .operational-photo-summary { padding-left: 0; border-left: 0; }
  .operational-photo-summary-body { flex-wrap: wrap; }
  .operational-photo-link { margin-left: 0; }
  .ficha-activity-card > div:nth-child(2) { grid-template-columns: minmax(0, 1fr); }
  .ficha-evidence-tabs { grid-template-columns: minmax(0, 1fr); }
  .ficha-evidence-tab { grid-template-columns: 20px minmax(0, 1fr) auto; }
}

@media (max-width: 1050px) {
  .exp-operations-grid { grid-template-columns: repeat(9, minmax(120px, 1fr)) !important; }
  .exp-operations-heading small { display: none; }
}

@media (max-width: 768px) {
  .exp-head-actions { width: 100%; flex-wrap: wrap; }
  .exp-head-actions .btn { flex: 1 1 auto; justify-content: center; }
  .exp-operations-heading { align-items: center; }
  .exp-operations-grid { grid-template-columns: repeat(9, minmax(112px, 1fr)) !important; }
  .exp-operation-card { min-height: 62px; }

  .ficha-case-hero { padding: 0.7rem; border-radius: 14px; }
  .ficha-next-action {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .ficha-next-action > span { grid-column: 1 / -1; }
  .ficha-next-action strong { white-space: normal; }
  .ficha-subnav-label { flex-basis: 100%; }
}

@media (max-width: 520px) {
  .exp-operations-heading { padding-inline: 0.8rem; }
  .exp-filter-panel { padding: 0.75rem !important; }
  .ficha-next-action { grid-template-columns: minmax(0, 1fr); }
  .ficha-next-action small { white-space: normal; }
}

/* Vista compacta: colapsa los módulos plegables también en escritorio
   (sin desmontar el contenido, solo se oculta vía CSS → no se pierde estado) */
.ficha-compact .mobile-collapsible-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  gap: 0.5rem;
}
.ficha-compact .mobile-collapsible-toggle:hover { background: var(--bg-soft); }
.ficha-compact .mobile-collapsible-body { display: none; }
.ficha-compact .mobile-collapsible-body.is-open { display: block; padding-top: 0.4rem; }

@media (max-width: 768px) {
  .ficha-subnav {
    top: 0;
    padding: 0.4rem 0.5rem;
  }
  .ficha-subnav-label { font-size: 0.64rem; }
  /* Selector de vista compacto en móvil */
  .ficha-view-toggle-top { padding: 0.18rem; }
  .ficha-view-toggle-top .ficha-view-toggle-prefix { display: none; }
  .ficha-view-toggle-top .ficha-view-btn { min-width: 88px; padding: 0.38rem 0.58rem; }
}

/* Calmar paleta de la ficha: bordes de color más finos y discretos */
.ficha-left > section.card[style],
.ficha-right > section.card[style],
.ficha-left > div > section.card[style] {
  border-top-width: 2px !important;
}
/* Read-only expediente snapshot shown before trash actions. */
.trash-preview {
  display: grid;
  gap: 1rem;
}

.trash-preview-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border-color));
  border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, var(--bg-card)), var(--bg-soft));
}

.trash-preview-banner > div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.trash-preview-banner strong {
  color: var(--text-main);
  font-size: 1.05rem;
}

.trash-preview-banner div > span:last-child {
  color: var(--neutral-500);
  font-size: 0.8rem;
}

.trash-preview-eyebrow {
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trash-preview-days {
  flex-shrink: 0;
  padding: 0.25rem 0.55rem;
  border: 1px solid #fde68a;
  border-radius: 999px;
  background: #fffbeb;
  color: #b45309;
  font-size: 0.72rem;
  font-weight: 800;
}

.trash-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.trash-preview-detail {
  min-width: 0;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

.trash-preview-detail:nth-child(odd) {
  border-right: 1px solid var(--border-color);
}

.trash-preview-detail:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.trash-preview-detail-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
  color: var(--neutral-500);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.trash-preview-detail-value {
  overflow-wrap: anywhere;
  color: var(--text-main);
  font-size: 0.83rem;
  font-weight: 650;
}

.trash-preview-detail-value.is-empty {
  color: var(--neutral-400);
  font-weight: 500;
}

.trash-preview-deleted {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--neutral-500);
  font-size: 0.75rem;
}

.trash-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.2rem;
}

.trash-preview-delete {
  border-color: #fecaca !important;
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

@media (max-width: 640px) {
  .trash-preview-banner,
  .trash-preview-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .trash-preview-days {
    align-self: flex-start;
  }

  .trash-preview-grid {
    grid-template-columns: 1fr;
  }

  .trash-preview-detail,
  .trash-preview-detail:nth-child(odd),
  .trash-preview-detail:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }

  .trash-preview-detail:last-child {
    border-bottom: 0;
  }

  .trash-preview-actions .btn {
    justify-content: center;
    width: 100%;
  }
}
/* First-login welcome shown once per user and workspace. */
.welcome-onboarding {
  display: grid;
  gap: 1rem;
}

.welcome-onboarding-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 164px;
  overflow: hidden;
  padding: 1.35rem 1.5rem;
  border-radius: 16px;
  background:
    radial-gradient(circle at 82% 18%, rgba(45, 212, 191, 0.26), transparent 27%),
    linear-gradient(130deg, #12355b 0%, #0f4c5c 58%, #146b66 100%);
  color: #fff;
}

.welcome-onboarding-glow {
  position: absolute;
  right: -58px;
  bottom: -90px;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(255, 255, 255, 0.035), 0 0 0 68px rgba(255, 255, 255, 0.025);
}

.welcome-onboarding-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 540px;
}

.welcome-onboarding-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
  color: #99f6e4;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome-onboarding-hero h3 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.25rem, 2.5vw, 1.7rem);
  line-height: 1.18;
}

.welcome-onboarding-hero p {
  max-width: 520px;
  margin: 0.55rem 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.82rem;
  line-height: 1.55;
}

.welcome-onboarding-progress {
  position: relative;
  z-index: 1;
  display: grid;
  place-content: center;
  flex: 0 0 98px;
  width: 98px;
  height: 98px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.05);
  text-align: center;
  backdrop-filter: blur(8px);
}

.welcome-onboarding-progress strong {
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
}

.welcome-onboarding-progress span {
  margin-top: 0.3rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.65rem;
  font-weight: 700;
}

.welcome-onboarding-progressbar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-soft);
}

.welcome-onboarding-progressbar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #2dd4bf);
  transition: width 500ms ease;
}

.welcome-onboarding-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.welcome-onboarding-heading h4 {
  margin: 0;
  color: var(--text-main);
  font-size: 0.92rem;
}

.welcome-onboarding-heading p {
  margin: 0.2rem 0 0;
  color: var(--neutral-500);
  font-size: 0.72rem;
}

.welcome-onboarding-heading > span {
  padding: 0.2rem 0.55rem;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 0.67rem;
  font-weight: 800;
}

.welcome-onboarding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.welcome-onboarding-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  min-height: 94px;
  padding: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
}

.welcome-onboarding-step:not(.is-done) {
  border-color: color-mix(in srgb, #0f766e 28%, var(--border-color));
  box-shadow: 0 5px 18px rgba(15, 76, 92, 0.06);
}

.welcome-onboarding-step.is-done {
  background: color-mix(in srgb, var(--bg-soft) 82%, var(--bg-card));
}

.welcome-onboarding-step-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, #0f766e 10%, var(--bg-card));
  color: #0f766e;
}

.welcome-onboarding-step.is-done .welcome-onboarding-step-icon {
  background: color-mix(in srgb, #16a34a 10%, var(--bg-card));
  color: #16a34a;
}

.welcome-onboarding-step-copy {
  min-width: 0;
}

.welcome-onboarding-step-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-main);
  font-size: 0.77rem;
}

.welcome-onboarding-step-title > svg {
  flex-shrink: 0;
  color: #0f766e;
}

.welcome-onboarding-step.is-done .welcome-onboarding-step-title > svg {
  color: #16a34a;
}

.welcome-onboarding-step-title small {
  margin-left: auto;
  color: var(--neutral-500);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
}

.welcome-onboarding-step-copy p {
  margin: 0.28rem 0 0;
  color: var(--neutral-500);
  font-size: 0.68rem;
  line-height: 1.4;
}

.welcome-onboarding-step.is-done .welcome-onboarding-step-copy {
  opacity: 0.7;
}

.welcome-onboarding-action {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 0.35rem;
  margin-top: -0.1rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0f766e;
  font-size: 0.68rem;
  font-weight: 800;
}

.welcome-onboarding-action:hover {
  color: #115e59;
  text-decoration: underline;
}

.welcome-onboarding-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.25rem;
}

.welcome-onboarding-footer p {
  margin: 0;
  color: var(--neutral-500);
  font-size: 0.68rem;
}

@media (max-width: 680px) {
  .welcome-onboarding-hero {
    align-items: flex-start;
    min-height: 0;
    padding: 1.1rem;
  }

  .welcome-onboarding-progress {
    flex-basis: 76px;
    width: 76px;
    height: 76px;
  }

  .welcome-onboarding-progress strong {
    font-size: 1.05rem;
  }

  .welcome-onboarding-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .welcome-onboarding-hero {
    flex-direction: column;
  }

  .welcome-onboarding-progress {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: auto;
    height: auto;
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
  }

  .welcome-onboarding-progress span {
    margin: 0;
  }

  .welcome-onboarding-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .welcome-onboarding-footer .btn {
    justify-content: center;
    width: 100%;
  }
}
/* Compact way back to the setup guide after following one of its actions. */
.welcome-onboarding-return {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 850;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  max-width: min(390px, calc(100vw - 2rem));
  padding: 0.65rem 0.75rem;
  border: 1px solid color-mix(in srgb, #0f766e 28%, var(--border-color));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  color: var(--text-main);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  text-align: left;
  backdrop-filter: blur(14px);
  animation: onboardingReturnIn 280ms ease-out;
}

.welcome-onboarding-return:hover {
  border-color: #0f766e;
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(15, 76, 92, 0.22);
}

.welcome-onboarding-return-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: color-mix(in srgb, #0f766e 12%, var(--bg-card));
  color: #0f766e;
}

.welcome-onboarding-return-copy {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 0.1rem;
}

.welcome-onboarding-return-copy small {
  color: #0f766e;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.welcome-onboarding-return-copy strong {
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-onboarding-return-progress {
  padding: 0.2rem 0.42rem;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.67rem;
  font-weight: 850;
}

@keyframes onboardingReturnIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  .welcome-onboarding-return {
    right: 0.75rem;
    bottom: 0.75rem;
    left: 0.75rem;
    max-width: none;
  }
}
/* Gerencia: compact operational cockpit. */
.manager-cockpit {
  display: grid;
  gap: 0.65rem;
}

.manager-dashboard-page {
  gap: 0.6rem !important;
  padding-bottom: 0.5rem !important;
}

/* Perito de gabinete: jornada completa sin convertir el panel en un informe. */
.perito-cockpit {
  display: grid;
  gap: 0.7rem;
}

.perito-hero {
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(640px, 2.1fr);
  align-items: stretch;
  gap: 0.7rem;
  padding: 0.7rem;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  background:
    radial-gradient(circle at 14% 0%, rgba(20, 184, 166, 0.16), transparent 32%),
    linear-gradient(125deg, #0f2942 0%, #123d52 52%, #0f766e 100%);
  box-shadow: 0 10px 28px rgba(15, 41, 66, 0.12);
}

.perito-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  color: #fff;
}

.perito-hero-copy > span,
.perito-panel-head > div > span {
  color: #5eead4;
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.perito-hero-copy strong {
  margin-top: 0.2rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.08;
}

.perito-hero-copy small {
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.73rem;
}

.perito-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.perito-kpi {
  --perito-tone: #2563eb;
  --perito-soft: #eff6ff;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.55rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.perito-kpi:hover { background: rgba(255, 255, 255, 0.17); transform: translateY(-1px); }
.perito-kpi.is-red { --perito-tone: #f87171; --perito-soft: rgba(248, 113, 113, 0.16); }
.perito-kpi.is-amber { --perito-tone: #fbbf24; --perito-soft: rgba(251, 191, 36, 0.16); }
.perito-kpi.is-cyan { --perito-tone: #67e8f9; --perito-soft: rgba(103, 232, 249, 0.14); }

.perito-kpi-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--perito-soft);
  color: var(--perito-tone);
}

.perito-kpi > span:nth-child(2) { display: grid; min-width: 0; }
.perito-kpi small { color: rgba(255, 255, 255, 0.72); font-size: 0.63rem; font-style: normal; font-weight: 800; text-transform: uppercase; }
.perito-kpi strong { color: #fff; font-size: 1.25rem; line-height: 1.05; }
.perito-kpi em { overflow: hidden; color: rgba(255, 255, 255, 0.62); font-size: 0.6rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.perito-kpi > svg { color: rgba(255, 255, 255, 0.48); }

.perito-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(280px, 0.85fr);
  align-items: start;
  gap: 0.7rem;
}

.perito-focus-panel,
.perito-side-panel {
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.045);
}

.perito-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  min-height: 55px;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border-color);
}

.perito-panel-head > div { display: grid; gap: 0.08rem; min-width: 0; }
.perito-panel-head > div > span { color: #0f766e; font-size: 0.61rem; }
.perito-panel-head > div > strong { color: var(--text-main); font-size: 0.92rem; }
.perito-panel-head button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-family: inherit;
  font-size: 0.69rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.perito-panel-head.is-small { min-height: 48px; padding: 0.55rem 0.65rem; }
.perito-panel-head.is-small > div > strong { font-size: 0.82rem; }

.perito-focus-list { display: grid; }
.perito-focus-row {
  display: grid;
  grid-template-columns: 28px minmax(150px, 1fr) auto minmax(160px, 0.8fr) auto 16px;
  align-items: center;
  gap: 0.55rem;
  min-height: 62px;
  padding: 0.5rem 0.7rem;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.perito-focus-row:last-child { border-bottom: 0; }
.perito-focus-row:hover { background: #f8fafc; }
.perito-priority-index { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: #f1f5f9; color: #64748b; font-size: 0.68rem; font-weight: 900; }
.perito-priority-index.is-critical { background: #fef2f2; color: #dc2626; }
.perito-focus-main, .perito-focus-next { display: grid; min-width: 0; gap: 0.08rem; }
.perito-focus-main strong { overflow: hidden; color: #0f172a; font-size: 0.8rem; text-overflow: ellipsis; white-space: nowrap; }
.perito-focus-main small, .perito-focus-next small { overflow: hidden; color: #64748b; font-size: 0.66rem; text-overflow: ellipsis; white-space: nowrap; }
.perito-focus-next strong { font-size: 0.7rem; }
.perito-focus-state { padding: 0.24rem 0.45rem; border: 1px solid; border-radius: 999px; font-size: 0.63rem; font-weight: 800; white-space: nowrap; }
.perito-message-count { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.2rem 0.38rem; border-radius: 999px; background: #e0f2fe; color: #0369a1; font-size: 0.63rem; font-weight: 900; }
.perito-message-count.is-urgent { background: #fee2e2; color: #b91c1c; }
.perito-row-arrow { color: #cbd5e1; }

.perito-empty-focus { display: flex; align-items: center; justify-content: center; gap: 0.65rem; min-height: 140px; color: #0f766e; }
.perito-empty-focus > div { display: grid; gap: 0.1rem; }
.perito-empty-focus strong { color: #0f172a; font-size: 0.85rem; }
.perito-empty-focus span { color: #64748b; font-size: 0.7rem; }

.perito-side-stack { display: grid; gap: 0.7rem; }
.perito-message-list { display: grid; }
.perito-message-list > button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.perito-message-list > button:last-child { border-bottom: 0; }
.perito-message-list > button:hover { background: #f8fafc; }
.perito-message-list > button > span:nth-child(2) { display: grid; min-width: 0; gap: 0.05rem; }
.perito-message-list strong, .perito-message-list small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perito-message-list strong { color: #0f172a; font-size: 0.72rem; }
.perito-message-list small { color: #64748b; font-size: 0.62rem; }
.perito-message-list > button > svg { color: #cbd5e1; }
.perito-message-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #e0f2fe; color: #0369a1; }
.perito-message-icon.is-urgent { background: #fee2e2; color: #b91c1c; }
.perito-compact-empty { display: flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 66px; color: #94a3b8; font-size: 0.7rem; font-weight: 700; }
.perito-notice-total { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 0.35rem; border-radius: 999px; background: #7c3aed; color: #fff; font-size: 0.65rem; font-weight: 900; }

.perito-today-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.perito-today-grid > div { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: center; gap: 0.18rem 0.32rem; min-height: 58px; border-right: 1px solid var(--border-color); color: #0f766e; }
.perito-today-grid > div:last-child { border-right: 0; }
.perito-today-grid strong { color: #0f172a; font-size: 0.9rem; }
.perito-today-grid span { grid-column: 1 / -1; color: #64748b; font-size: 0.6rem; text-align: center; }

@media (max-width: 1180px) {
  .perito-hero { grid-template-columns: 1fr; }
  .perito-workspace-grid { grid-template-columns: 1fr; }
  .perito-side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .perito-notices-panel { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .perito-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .perito-focus-row { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .perito-focus-state { grid-column: 2; width: fit-content; }
  .perito-focus-next { grid-column: 2 / 4; }
  .perito-message-count { grid-column: 3; grid-row: 1; }
  .perito-row-arrow { display: none; }
  .perito-side-stack { grid-template-columns: 1fr; }
  .perito-notices-panel { grid-column: auto; }
}

.manager-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.manager-kpi {
  --manager-tone: #2563eb;
  --manager-soft: #eff6ff;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  min-height: 82px;
  overflow: hidden;
  padding: 0.65rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--manager-tone) 18%, var(--border-color));
  border-radius: 14px;
  background:
    linear-gradient(125deg, color-mix(in srgb, var(--manager-soft) 74%, var(--bg-card)) 0%, var(--bg-card) 68%);
  color: var(--text-main);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.035);
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.manager-kpi::after {
  position: absolute;
  right: -24px;
  bottom: -34px;
  width: 82px;
  height: 82px;
  border: 10px solid color-mix(in srgb, var(--manager-tone) 6%, transparent);
  border-radius: 50%;
  content: '';
}

.manager-kpi:hover {
  z-index: 1;
  border-color: color-mix(in srgb, var(--manager-tone) 45%, var(--border-color));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--manager-tone) 12%, transparent);
  transform: translateY(-2px);
}

.manager-kpi.is-danger { --manager-tone: #dc2626; --manager-soft: #fef2f2; }
.manager-kpi.is-warning { --manager-tone: #d97706; --manager-soft: #fffbeb; }
.manager-kpi.is-success { --manager-tone: #16a34a; --manager-soft: #f0fdf4; }
.manager-kpi.is-review { --manager-tone: #0891b2; --manager-soft: #ecfeff; }
.manager-kpi.is-neutral { --manager-tone: #64748b; --manager-soft: #f8fafc; }

.manager-kpi-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--manager-tone) 11%, var(--bg-card));
  color: var(--manager-tone);
}

.manager-kpi-copy {
  display: grid;
  min-width: 0;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 0.5rem;
}

.manager-kpi-copy small {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--neutral-500);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.manager-kpi-copy strong {
  color: var(--manager-tone);
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1.05;
}

.manager-kpi-copy em {
  overflow: hidden;
  color: var(--neutral-400);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-kpi-arrow {
  position: relative;
  z-index: 1;
  color: color-mix(in srgb, var(--manager-tone) 55%, var(--neutral-300));
}

.manager-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.65fr);
  gap: 0.65rem;
}

.manager-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 15px;
  background: var(--bg-card);
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.035);
}

.manager-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-soft) 55%, var(--bg-card)), var(--bg-card));
}

.manager-panel-head h2 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.08rem 0 0;
  color: var(--text-main);
  font-size: 0.98rem;
}

.manager-attention .manager-panel-head h2 svg { color: #dc2626; }
.manager-team .manager-panel-head h2 svg { color: #0f766e; }

.manager-eyebrow {
  color: var(--neutral-400);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.manager-text-link,
.manager-icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 750;
  white-space: nowrap;
}

.manager-icon-link {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-card);
}

.manager-attention-list,
.manager-team-list {
  display: grid;
}

.manager-attention-row {
  --attention-tone: #64748b;
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) minmax(125px, auto) auto;
  align-items: center;
  gap: 0.65rem;
  min-height: 54px;
  padding: 0.46rem 0.8rem 0.46rem 0.6rem;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  text-align: left;
  transition: background 120ms ease;
}

.manager-attention-row:last-child { border-bottom: 0; }
.manager-attention-row:hover { background: color-mix(in srgb, var(--attention-tone) 4%, var(--bg-card)); }
.manager-attention-row.is-danger { --attention-tone: #dc2626; }
.manager-attention-row.is-warning { --attention-tone: #d97706; }
.manager-attention-row.is-review { --attention-tone: #0891b2; }
.manager-attention-row.is-watch { --attention-tone: #ea580c; }

.manager-attention-signal {
  width: 4px;
  height: 28px;
  border-radius: 999px;
  background: var(--attention-tone);
}

.manager-attention-main,
.manager-attention-title {
  display: flex;
  min-width: 0;
  align-items: center;
}

.manager-attention-main {
  align-items: flex-start;
  flex-direction: column;
  gap: 0.1rem;
}

.manager-attention-title { gap: 0.4rem; }

.manager-attention-title strong {
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-attention-title small {
  padding: 0.06rem 0.35rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 750;
  white-space: nowrap;
}

.manager-attention-meta {
  overflow: hidden;
  width: 100%;
  color: var(--neutral-400);
  font-size: 0.69rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-attention-reason {
  display: grid;
  justify-items: end;
  color: var(--attention-tone);
}

.manager-attention-reason strong { font-size: 0.75rem; white-space: nowrap; }
.manager-attention-reason small { color: var(--neutral-400); font-size: 0.62rem; }
.manager-attention-row > svg { color: var(--neutral-300); }

.manager-clear-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 235px;
  padding: 1.25rem;
  text-align: left;
}

.manager-clear-state > span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #ecfdf5;
  color: #059669;
}

.manager-clear-state div { display: grid; gap: 0.15rem; }
.manager-clear-state strong { font-size: 0.82rem; }
.manager-clear-state small { color: var(--neutral-400); font-size: 0.66rem; }

.manager-person {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 64px;
  padding: 0.48rem 0.8rem;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  text-align: left;
}

.manager-person:last-child { border-bottom: 0; }
.manager-person:hover { background: var(--bg-soft); }

.manager-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 36px;
  height: 36px;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 0.72rem;
  font-weight: 850;
}

.manager-avatar.is-risk { border-color: #fecaca; background: #fef2f2; color: #dc2626; }
.manager-avatar.is-watch { border-color: #fed7aa; background: #fff7ed; color: #c2410c; }

.manager-person-main { display: grid; flex: 1; min-width: 0; gap: 0.22rem; }
.manager-person-line { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.manager-person-line strong { overflow: hidden; font-size: 0.8rem; text-overflow: ellipsis; white-space: nowrap; }
.manager-person-line b { color: var(--text-main); font-size: 0.95rem; }

.manager-load-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--neutral-100);
}

.manager-load-track i { display: block; height: 100%; border-radius: inherit; background: #22c55e; }
.manager-load-track i.is-risk { background: linear-gradient(90deg, #dc2626, #f87171); }
.manager-load-track i.is-watch { background: linear-gradient(90deg, #ea580c, #fb923c); }
.manager-person-note { color: var(--neutral-400); font-size: 0.66rem; }

.manager-team-more,
.manager-team-empty button {
  padding: 0.45rem;
  border: 0;
  background: var(--bg-soft);
  color: var(--primary);
  font-size: 0.62rem;
  font-weight: 750;
}

.manager-team-empty {
  display: grid;
  place-items: center;
  min-height: 235px;
  padding: 1rem;
  color: var(--neutral-400);
  font-size: 0.68rem;
  text-align: center;
}

.manager-month-strip {
  display: grid;
  grid-template-columns: minmax(155px, 1.2fr) repeat(4, minmax(105px, 0.8fr)) auto;
  align-items: stretch;
  min-height: 80px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 15px;
  background: var(--bg-card);
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.035);
}

.manager-month-title,
.manager-month-metric,
.manager-month-link {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.8rem;
  border-right: 1px solid var(--border-color);
}

.manager-month-title { gap: 0.55rem; background: linear-gradient(135deg, #12355b, #0f4c5c); color: #fff; }
.manager-month-title > span { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: rgba(255,255,255,0.11); color: #99f6e4; }
.manager-month-title div { display: grid; }
.manager-month-title small { color: rgba(255,255,255,0.68); font-size: 0.64rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.manager-month-title strong { color: #fff; font-size: 0.92rem; text-transform: capitalize; }

.manager-month-metric { align-items: flex-start; justify-content: center; flex-direction: column; gap: 0.15rem; }
.manager-month-metric small { color: var(--neutral-400); font-size: 0.64rem; font-weight: 700; }
.manager-month-metric strong { display: flex; align-items: center; gap: 0.25rem; color: var(--text-main); font-size: 1.2rem; font-weight: 900; }
.manager-month-metric.is-positive strong { color: #16a34a; }
.manager-month-metric.is-warning strong { color: #d97706; }

.manager-month-link {
  justify-content: center;
  gap: 0.3rem;
  border: 0;
  background: var(--bg-soft);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 750;
  white-space: nowrap;
}

@media (max-width: 1050px) {
  .manager-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manager-main-grid { grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr); }
  .manager-month-strip { grid-template-columns: repeat(4, minmax(100px, 1fr)); }
  .manager-month-title { grid-column: 1 / 3; }
  .manager-month-link { grid-column: 3 / 5; border-top: 1px solid var(--border-color); }
}

@media (max-width: 760px) {
  .manager-main-grid { grid-template-columns: minmax(0, 1fr); }
  .manager-attention-row { grid-template-columns: 5px minmax(0, 1fr) auto; }
  .manager-attention-reason { grid-column: 2; justify-items: start; }
  .manager-attention-row > svg { grid-column: 3; grid-row: 1 / 3; }
}

@media (max-width: 520px) {
  .manager-kpis { grid-template-columns: minmax(0, 1fr); }
  .manager-kpi { min-height: 66px; }
  .manager-month-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manager-month-title,
  .manager-month-link { grid-column: 1 / -1; }
  .manager-month-metric { border-top: 1px solid var(--border-color); }
  .manager-text-link { font-size: 0; }
  .manager-text-link svg { width: 16px; height: 16px; }
}
/* Espacio de trabajo de facturación: vista de documento + inspector lateral. */
.invoice-workspace { display:grid; gap:.8rem; }
.invoice-workspace__topbar { display:flex; justify-content:space-between; align-items:center; gap:1rem; }
.invoice-workspace__topbar > div { display:grid; gap:.18rem; }
.invoice-workspace__topbar span { color:var(--neutral-500); font-size:.75rem; }
.invoice-workspace__body { display:grid; grid-template-columns:minmax(0, 1fr) 340px; min-height:720px; border:1px solid var(--border-color); border-radius:18px; overflow:hidden; background:#f4f7fb; box-shadow:0 12px 30px rgba(15,23,42,.06); }
.invoice-canvas-wrap { padding:2rem; overflow:auto; }
.invoice-canvas { max-width:820px; min-height:650px; margin:0 auto; padding:2rem 2.2rem 1.6rem; background:#fff; border:1px solid #e2e8f0; border-radius:14px; box-shadow:0 2px 8px rgba(15,23,42,.05); color:#1e293b; }
.invoice-canvas__issuer { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:.8rem; padding-bottom:1.5rem; border-bottom:1px solid #e2e8f0; }
.invoice-canvas__issuer > div:nth-child(2), .invoice-canvas__client > div:first-child { display:grid; gap:.2rem; }
.invoice-canvas__issuer strong, .invoice-canvas__client strong { font-size:.95rem; }
.invoice-canvas__issuer span, .invoice-canvas__client span { color:#64748b; font-size:.72rem; }
.invoice-brand-mark { width:44px; height:44px; display:grid; place-items:center; border-radius:13px; background:linear-gradient(145deg,#ede9fe,#dbeafe); color:#5b5bd6; font-size:1.2rem; font-weight:900; }
.invoice-qr-placeholder { width:68px; height:68px; border:2px dashed #94a3b8; border-radius:8px; display:grid; place-content:center; text-align:center; color:#334155; }
.invoice-qr-placeholder span { color:#0f172a; font-weight:900; font-size:1rem; }
.invoice-qr-placeholder small { font-size:.5rem; }
.invoice-canvas__client { display:flex; justify-content:space-between; gap:1rem; align-items:end; padding:1.35rem 0; border-bottom:1px solid #e2e8f0; }
.invoice-canvas__client label, .invoice-canvas__footer label { color:#64748b; font-weight:800; font-size:.65rem; letter-spacing:.04em; }
.invoice-canvas__total { text-align:right; display:grid; gap:.2rem; }
.invoice-canvas__total strong { font-size:1.6rem; }
.invoice-lines-editor { padding:1rem 0 1.2rem; border-bottom:1px solid #e2e8f0; }
.invoice-lines-editor__head, .invoice-lines-editor__row { display:grid; grid-template-columns:minmax(170px,1fr) 66px 82px 56px 56px 90px 28px; gap:.4rem; align-items:center; }
.invoice-lines-editor__head { padding:.25rem .1rem .55rem; color:#64748b; font-size:.62rem; text-transform:uppercase; font-weight:800; }
.invoice-lines-editor__row { padding:.5rem .1rem; border-top:1px solid #f1f5f9; }
.invoice-lines-editor__row > strong { text-align:right; font-size:.75rem; }
.invoice-inline-input { width:100%; min-width:0; border:1px solid transparent; border-radius:7px; padding:.42rem .35rem; background:transparent; color:#334155; font:inherit; font-size:.75rem; text-align:right; }
.invoice-inline-input--concept { text-align:left; font-weight:650; }
.invoice-inline-input:hover,.invoice-inline-input:focus { border-color:#cbd5e1; background:#f8fafc; outline:none; }
.invoice-line-delete { border:0; background:transparent; color:#94a3b8; cursor:pointer; padding:.2rem; }
.invoice-line-delete:hover { color:#dc2626; }
.invoice-add-line { margin-top:.7rem; border:0; background:transparent; color:#2563eb; font-weight:700; font-size:.73rem; display:flex; gap:.3rem; align-items:center; cursor:pointer; }
.invoice-canvas__footer { display:grid; grid-template-columns:1fr 240px; gap:2rem; padding-top:1.25rem; }
.invoice-canvas__footer > div:first-child { display:grid; align-content:start; gap:.35rem; }
.invoice-canvas__footer textarea { min-height:80px; resize:vertical; border:0; padding:0; font:inherit; font-size:.72rem; color:#64748b; outline:none; }
.invoice-totals { display:grid; gap:.55rem; }
.invoice-totals span,.invoice-totals > strong { display:flex; justify-content:space-between; font-size:.75rem; color:#64748b; }
.invoice-totals > strong { padding-top:.55rem; border-top:1px solid #e2e8f0; color:#0f172a; font-size:.82rem; }
.invoice-inspector { background:#fff; border-left:1px solid #e2e8f0; padding:1.1rem; display:flex; flex-direction:column; gap:1rem; }
.invoice-inspector__tabs { display:grid; grid-template-columns:repeat(3,1fr); gap:.2rem; padding:.25rem; border:1px solid #e2e8f0; border-radius:12px; }
.invoice-inspector__tabs button { min-width:0; border:0; background:transparent; padding:.55rem .25rem; border-radius:9px; color:#64748b; font:inherit; font-size:.68rem; font-weight:700; cursor:pointer; display:flex; justify-content:center; gap:.25rem; align-items:center; }
.invoice-inspector__tabs button.active { background:#172033; color:#fff; }
.invoice-inspector__form { display:grid; grid-template-columns:1fr 1fr; gap:.65rem; }
.invoice-inspector__form .form-group:first-child,.invoice-inspector__form .form-group:last-child { grid-column:1/-1; }
.invoice-payment-card { border-top:1px solid #e2e8f0; padding-top:1rem; display:grid; gap:.5rem; }
.invoice-payment-card > div:first-child { display:flex; align-items:center; gap:.4rem; font-size:.75rem; }
.invoice-payment-card > div:first-child span { margin-left:auto; color:#16a34a; font-weight:800; }
.invoice-payment-bar { height:7px; overflow:hidden; border-radius:999px; background:#dcfce7; }
.invoice-payment-bar i { display:block; height:100%; border-radius:inherit; background:#22c55e; }
.invoice-payment-card small { color:#64748b; font-size:.68rem; }
.invoice-status-card { display:flex; justify-content:space-between; align-items:center; border:1px solid #e2e8f0; border-radius:10px; padding:.8rem; color:#2563eb; }
.invoice-status-card span { color:#92400e; background:#fffbeb; border-radius:999px; padding:.25rem .55rem; font-size:.7rem; font-weight:750; }
.invoice-status-card span i { display:inline-block; width:7px; height:7px; border-radius:50%; background:#f59e0b; margin-right:.3rem; }
.invoice-theme-row { margin-top:auto; padding-top:1rem; border-top:1px solid #e2e8f0; display:flex; align-items:center; gap:.5rem; color:#64748b; font-size:.72rem; }
.invoice-theme-row span { margin-right:auto; }
.invoice-theme-row i { width:20px; height:20px; border-radius:50%; background:#6366f1; box-shadow:0 0 0 2px #fff,0 0 0 3px #c7d2fe; }
.invoice-theme-row i:nth-last-child(2) { background:#0891b2; box-shadow:none; }
.invoice-theme-row i:last-child { background:#059669; box-shadow:none; }
.invoice-save-button { width:100%; justify-content:center; padding:.7rem; }
.invoice-side-empty { display:grid; justify-items:center; text-align:center; gap:.65rem; padding:2rem .5rem; color:#64748b; }
.invoice-side-empty strong { color:#1e293b; }
.invoice-side-empty p { font-size:.74rem; margin:0; }
.invoice-side-empty textarea { width:100%; min-height:120px; border:1px solid #cbd5e1; border-radius:10px; padding:.7rem; resize:vertical; font:inherit; font-size:.75rem; }
.invoice-history-list { display:grid; gap:0; padding:.5rem 0; }
.invoice-history-list > div { position:relative; display:flex; gap:.65rem; padding:0 0 1.2rem; }
.invoice-history-list > div:not(:last-child)::after { content:''; position:absolute; left:5px; top:13px; bottom:0; width:1px; background:#cbd5e1; }
.invoice-history-list i { width:11px; height:11px; margin-top:3px; border-radius:50%; background:#2563eb; z-index:1; }
.invoice-history-list span { display:grid; gap:.2rem; font-size:.75rem; }
.invoice-history-list small { color:#94a3b8; }
@media (max-width:1050px) { .invoice-workspace__body { grid-template-columns:1fr; } .invoice-inspector { border-left:0; border-top:1px solid #e2e8f0; } }
@media (max-width:720px) { .invoice-canvas-wrap { padding:.75rem; } .invoice-canvas { padding:1rem; } .invoice-lines-editor { overflow-x:auto; } .invoice-lines-editor__head,.invoice-lines-editor__row { min-width:650px; } .invoice-canvas__footer { grid-template-columns:1fr; } }
.received-invoices,.received-editor { padding:1.1rem; display:grid; gap:1rem; }
.received-invoices__head,.received-editor__head,.received-editor__actions { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.received-invoices__head > div:first-child,.received-editor__head > div { display:grid; gap:.2rem; }
.received-invoices__head > div:last-child { display:flex; gap:.5rem; }
.received-invoices__head span,.received-editor__head span,.received-editor__actions span { color:var(--neutral-500); font-size:.74rem; }
.received-search { max-width:420px; display:flex; align-items:center; gap:.45rem; padding:.55rem .75rem; background:var(--bg-soft,#f8fafc); border:1px solid var(--border-color); border-radius:10px; color:var(--neutral-400); }
.received-search input { width:100%; border:0; outline:0; background:transparent; font:inherit; font-size:.78rem; }
.received-table-wrap { overflow:auto; }
.received-table-wrap table { width:100%; border-collapse:collapse; font-size:.78rem; }
.received-table-wrap th { padding:.65rem; text-align:left; color:var(--neutral-500); font-size:.68rem; text-transform:uppercase; }
.received-table-wrap td { padding:.75rem .65rem; border-top:1px solid var(--border-color); }
.received-table-wrap td:first-child { display:grid; gap:.15rem; }
.received-table-wrap td small { color:var(--neutral-500); }
.received-table-wrap td:last-child { white-space:nowrap; text-align:right; }
.received-status { display:inline-block; border-radius:999px; padding:.25rem .5rem; background:#f1f5f9; font-size:.68rem; font-weight:750; }
.received-status--approved,.received-status--paid { background:#dcfce7; color:#166534; }
.received-status--rejected { background:#fee2e2; color:#991b1b; }
.received-status--pending_review { background:#fef3c7; color:#92400e; }
.received-empty { display:grid; justify-items:center; gap:.35rem; padding:3rem; text-align:center; color:var(--neutral-400); }
.received-empty strong { color:var(--neutral-700); }
.received-empty span { font-size:.76rem; }
.received-editor__grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.75rem; }
.received-editor__grid label { display:grid; gap:.3rem; color:var(--neutral-600); font-size:.7rem; font-weight:700; }
.received-editor__notes { grid-column:1/-1; }
.received-editor__notes textarea { min-height:90px; resize:vertical; }
.received-editor__actions { border-top:1px solid var(--border-color); padding-top:.8rem; }
@media(max-width:800px){.received-editor__grid{grid-template-columns:1fr 1fr}.received-invoices__head{align-items:flex-start;flex-direction:column}.received-invoices__head>div:last-child{flex-wrap:wrap}}
.verifactu-test-steps { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.65rem; }
.verifactu-test-steps > div { display:flex; gap:.65rem; align-items:flex-start; padding:.8rem; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-card); }
.verifactu-test-steps > div > span { width:25px; height:25px; flex:0 0 25px; display:grid; place-items:center; border-radius:50%; background:#dbeafe; color:#1d4ed8; font-size:.72rem; font-weight:800; }
.verifactu-test-steps p,.verifactu-test-lock span { display:grid; gap:.18rem; margin:0; font-size:.77rem; }
.verifactu-test-steps small,.verifactu-test-lock small { color:var(--neutral-500); font-weight:400; line-height:1.35; }
.verifactu-test-lock { display:flex; gap:.55rem; align-items:center; max-width:520px; padding:.7rem .8rem; border:1px solid #86efac; border-radius:10px; background:#f0fdf4; color:#166534; }
@media(max-width:760px){.verifactu-test-steps{grid-template-columns:1fr}}
.verifactu-test-center { padding:1.1rem; display:grid; gap:.85rem; border-color:#bfdbfe; }
.verifactu-test-center__head { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; }
.verifactu-test-center__head > div { display:grid; gap:.18rem; }
.verifactu-test-center__head > div > span { color:#2563eb; font-size:.68rem; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.verifactu-test-center__head > div > small { color:var(--neutral-500); }
.verifactu-test-badge { display:flex; align-items:center; gap:.3rem; padding:.35rem .55rem; border-radius:999px; background:#dcfce7; color:#166534; font-size:.68rem; font-weight:800; white-space:nowrap; }
.verifactu-test-notice { padding:.65rem .75rem; border-radius:9px; background:#fff7ed; color:#9a3412; font-size:.74rem; }
.verifactu-test-actions { display:flex; gap:.55rem; flex-wrap:wrap; }
.verifactu-test-result { display:flex; gap:.65rem; align-items:flex-start; padding:.75rem; border:1px solid #fde68a; border-radius:10px; background:#fffbeb; color:#92400e; }
.verifactu-test-result.success { border-color:#86efac; background:#f0fdf4; color:#166534; }
.verifactu-test-result > div { display:grid; gap:.15rem; }
.verifactu-test-result span { font-size:.73rem; }
.verifactu-test-history { border-top:1px solid var(--border-color); display:grid; }
.verifactu-test-history__title { padding:.75rem 0 .45rem; color:var(--neutral-500); font-size:.68rem; font-weight:800; text-transform:uppercase; }
.verifactu-test-history > div:not(.verifactu-test-history__title) { display:flex; justify-content:space-between; align-items:center; gap:1rem; padding:.55rem 0; border-top:1px solid #f1f5f9; }
.verifactu-test-history > div > span { display:grid; gap:.15rem; font-size:.76rem; }
.verifactu-test-history small { color:var(--neutral-500); }
.verifactu-test-history > div > div { display:flex; gap:.4rem; }
@media(max-width:650px){.verifactu-test-center__head,.verifactu-test-history>div:not(.verifactu-test-history__title){align-items:flex-start;flex-direction:column}.verifactu-test-badge{white-space:normal}}

/* Configuración guiada: jerarquía común y opciones avanzadas progresivas */
.settings-page { --settings-accent:#2563eb; }
.settings-page-head {
  position:relative;
  overflow:hidden;
  padding:1.35rem 1.5rem;
  border:1px solid #dbeafe;
  background:linear-gradient(135deg,#ffffff 0%,#f4f8ff 64%,#eef6ff 100%);
}
.settings-page-head::after { content:""; position:absolute; width:180px; height:180px; right:-70px; top:-105px; border-radius:50%; background:rgba(37,99,235,.09); }
.settings-page-kicker { display:block; margin-bottom:.2rem; color:#2563eb; font-size:.65rem; font-weight:850; letter-spacing:.09em; text-transform:uppercase; }
.settings-page-head .page-subtitle { margin:.25rem 0 0; color:var(--text-muted); }
.settings-nav { padding:.55rem !important; border-color:#dfe7f1; box-shadow:var(--shadow-sm); }
.settings-nav button { min-height:38px; margin:1px 0; }
.settings-nav button:hover { background:var(--bg-soft) !important; color:var(--text-main) !important; }
.settings-main { display:grid; gap:1rem; }

.settings-guide {
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  gap:1rem;
  align-items:start;
  padding:1.15rem 1.2rem;
  border:1px solid #bfdbfe;
  border-radius:16px;
  background:linear-gradient(145deg,#eff6ff,#ffffff 68%);
  box-shadow:0 8px 25px rgba(37,99,235,.07);
}
.settings-guide-icon,.settings-card-icon { display:grid; place-items:center; flex:0 0 auto; color:#2563eb; background:#dbeafe; }
.settings-guide-icon { width:44px; height:44px; border-radius:13px; }
.settings-guide-copy>span { display:block; color:#2563eb; font-size:.64rem; font-weight:850; letter-spacing:.08em; text-transform:uppercase; }
.settings-guide-copy h2 { margin:.12rem 0 .2rem; color:var(--text-main); font-size:1.15rem; letter-spacing:-.02em; }
.settings-guide-copy p { margin:0; color:var(--text-muted); font-size:.8rem; line-height:1.5; }
.settings-guide-steps { display:flex; flex-wrap:wrap; gap:.38rem .8rem; margin-top:.7rem; }
.settings-guide-steps small { display:inline-flex; align-items:center; gap:.3rem; color:var(--neutral-600); font-size:.69rem; }
.settings-guide-steps b { width:18px; height:18px; display:grid; place-items:center; border-radius:50%; background:#fff; border:1px solid #bfdbfe; color:#2563eb; font-size:.6rem; }
.settings-guide-badge,.settings-status-pill { display:inline-flex; align-items:center; gap:.3rem; padding:.32rem .55rem; border-radius:999px; background:#fff; border:1px solid #dbeafe; color:#2563eb; font-size:.67rem; font-weight:800; white-space:nowrap; }
.settings-guide-progress { min-width:92px; display:grid; justify-items:center; gap:.05rem; padding:.55rem .65rem; border:1px solid #bfdbfe; border-radius:12px; background:#fff; }
.settings-guide-progress strong { color:#2563eb; font-size:1.05rem; }
.settings-guide-progress span { color:var(--text-muted); font-size:.62rem; }
.settings-guide-progress.is-complete { border-color:#86efac; background:#f0fdf4; }
.settings-guide-progress.is-complete strong { color:#15803d; }

.settings-main>.card,.settings-card { border-color:#e1e8f0; box-shadow:0 8px 24px rgba(15,23,42,.045); }
.settings-card-heading { display:flex; align-items:flex-start; gap:.7rem; margin-bottom:.25rem; }
.settings-card-heading>div:nth-child(2) { min-width:0; flex:1; }
.settings-card-heading .section-title { margin:0; }
.settings-card-heading .section-subtitle { margin:.15rem 0 0; }
.settings-card-icon { width:36px; height:36px; border-radius:10px; }
.settings-required-legend { display:inline-flex; align-items:center; gap:.3rem; color:var(--text-muted); font-size:.66rem; white-space:nowrap; }
.settings-required-legend i,.form-label.is-required::after { content:""; width:6px; height:6px; border-radius:50%; background:#2563eb; }
.form-label.is-required { display:flex; align-items:center; gap:.35rem; }
.form-label small { margin-left:auto; color:var(--neutral-400); font-size:.62rem; font-weight:600; text-transform:none; }

.settings-field-group { min-width:0; margin:0; padding:1rem; border:1px solid var(--border-color); border-radius:13px; background:var(--bg-soft); }
.settings-field-group legend { padding:0 .38rem; color:var(--text-main); font-size:.84rem; font-weight:800; }
.settings-field-group>p { margin:-.15rem 0 .85rem; color:var(--text-muted); font-size:.7rem; }
.settings-field-group .form-group { margin-bottom:0; }
.settings-logo-field { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.85rem 1rem; border:1px dashed #cbd5e1; border-radius:12px; background:var(--bg-soft); }
.settings-logo-field>div:first-child { display:grid; gap:.1rem; }
.settings-save-bar { position:sticky; bottom:0; z-index:5; display:flex; justify-content:flex-start; gap:.8rem; align-items:center; flex-wrap:wrap; margin:0 -.25rem -.25rem; padding:.8rem; border:1px solid var(--border-color); border-radius:12px; background:color-mix(in srgb,var(--bg-card) 92%,transparent); backdrop-filter:blur(10px); }

.settings-advanced-card { overflow:hidden; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-soft); }
.settings-advanced-card>summary { list-style:none; display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.78rem .9rem; cursor:pointer; user-select:none; }
.settings-advanced-card>summary::-webkit-details-marker { display:none; }
.settings-advanced-card>summary::after { content:"⌄"; width:26px; height:26px; display:grid; place-items:center; border-radius:8px; color:var(--text-muted); background:var(--bg-card); border:1px solid var(--border-color); transition:transform .18s; }
.settings-advanced-card[open]>summary::after { transform:rotate(180deg); }
.settings-advanced-card>summary span { display:grid; gap:.1rem; }
.settings-advanced-card>summary strong { color:var(--text-main); font-size:.79rem; }
.settings-advanced-card>summary small { color:var(--text-muted); font-size:.68rem; font-weight:500; }
.settings-advanced-body { padding:.9rem; border-top:1px solid var(--border-color); background:var(--bg-card); }
.settings-advanced-stack { display:grid; gap:.85rem; }
.settings-preview-box { display:grid; gap:.35rem; padding:.8rem .9rem; border:1px solid #bfdbfe; border-radius:12px; background:#f8fbff; color:var(--text-main); }
.settings-preview-box>span { color:#1d4ed8; font-size:.66rem; font-weight:850; letter-spacing:.04em; text-transform:uppercase; }
.settings-preview-box>strong { overflow-wrap:anywhere; font-size:.86rem; }
.settings-load-preview>div { display:flex; align-items:center; flex-wrap:wrap; gap:.3rem; }
.settings-load-preview>div strong { padding:.25rem .45rem; border-radius:7px; background:#dcfce7; color:#166534; font-size:.68rem; }
.settings-load-preview>div strong:nth-of-type(2) { background:#fef3c7; color:#92400e; }
.settings-load-preview>div strong:nth-of-type(3) { background:#fee2e2; color:#991b1b; }
.settings-load-preview>div i { color:var(--text-muted); font-size:.7rem; font-style:normal; }

.settings-inline-steps { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.55rem; }
.settings-inline-steps>div { display:flex; gap:.55rem; padding:.7rem; border:1px solid #dbeafe; border-radius:11px; background:#f8fbff; }
.settings-inline-steps b { width:24px; height:24px; flex:0 0 24px; display:grid; place-items:center; border-radius:50%; color:#2563eb; background:#dbeafe; font-size:.68rem; }
.settings-inline-steps span { display:grid; gap:.1rem; }
.settings-inline-steps strong { font-size:.73rem; }
.settings-inline-steps small { color:var(--text-muted); font-size:.64rem; line-height:1.35; }

.settings-token-help { display:grid; gap:.45rem; padding:.7rem .8rem; border-radius:11px; background:#eff6ff; border:1px solid #bfdbfe; }
.settings-token-help>span { color:#1e3a8a; font-size:.72rem; font-weight:750; }
.settings-token-help>div { display:flex; flex-wrap:wrap; gap:.3rem; }
.settings-token-help code { padding:.18rem .4rem; border:1px solid #bfdbfe; border-radius:6px; background:#fff; color:#1d4ed8; font-size:.67rem; }
.settings-template-card { overflow:hidden; border:1px solid var(--border-color); border-radius:11px; background:var(--bg-soft); }
.settings-template-card>summary { list-style:none; display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.72rem .8rem; cursor:pointer; }
.settings-template-card>summary::-webkit-details-marker { display:none; }
.settings-template-card>summary span { min-width:0; display:grid; gap:.12rem; }
.settings-template-card>summary strong { font-size:.78rem; }
.settings-template-card>summary small { overflow:hidden; color:var(--text-muted); font-size:.67rem; text-overflow:ellipsis; white-space:nowrap; }
.settings-template-card>summary svg { flex:0 0 auto; color:var(--text-muted); transition:transform .18s; }
.settings-template-card[open]>summary svg { transform:rotate(180deg); }
.settings-template-editor { display:grid; gap:.35rem; padding:.75rem; border-top:1px solid var(--border-color); background:var(--bg-card); }
.settings-template-editor small { color:var(--text-muted); font-size:.65rem; }
.settings-status-pill.is-on { border-color:#86efac; background:#f0fdf4; color:#15803d; }
.settings-notifications>.settings-advanced-card .settings-advanced-body>div { margin-top:0 !important; padding-top:0 !important; border-top:0 !important; }
.settings-enabled-panel { display:grid; gap:.75rem; padding:.85rem; border:1px solid #bfdbfe; border-radius:12px; background:#f8fbff; }
.settings-enabled-heading { display:grid; gap:.1rem; }
.settings-enabled-heading strong { color:#1e3a8a; font-size:.78rem; }
.settings-enabled-heading small { color:var(--text-muted); font-size:.67rem; }
.settings-disabled-note { padding:.72rem .8rem; border:1px dashed #cbd5e1; border-radius:10px; background:var(--bg-soft); color:var(--text-muted); font-size:.73rem; }

:root[data-theme='dark'] .settings-page-head { border-color:var(--border-strong); background:linear-gradient(135deg,var(--bg-card),var(--bg-elevated)); }
:root[data-theme='dark'] .settings-guide { border-color:var(--border-strong); background:linear-gradient(145deg,var(--bg-accent),var(--bg-card) 68%); }
:root[data-theme='dark'] .settings-guide-steps b,
:root[data-theme='dark'] .settings-guide-badge,
:root[data-theme='dark'] .settings-guide-progress { border-color:var(--border-strong); background:var(--bg-elevated); }
:root[data-theme='dark'] .settings-guide-progress.is-complete,
:root[data-theme='dark'] .settings-status-pill.is-on { border-color:rgba(52,211,153,.45); background:var(--success-soft); color:var(--success); }
:root[data-theme='dark'] .settings-preview-box,
:root[data-theme='dark'] .settings-inline-steps>div,
:root[data-theme='dark'] .settings-token-help,
:root[data-theme='dark'] .settings-enabled-panel { border-color:var(--border-strong); background:var(--bg-accent); }
:root[data-theme='dark'] .settings-preview-box>span,
:root[data-theme='dark'] .settings-token-help>span,
:root[data-theme='dark'] .settings-enabled-heading strong { color:var(--primary-strong); }
:root[data-theme='dark'] .settings-token-help code { border-color:var(--border-strong); background:var(--bg-card); color:var(--primary-strong); }

@media(max-width:900px){
  .settings-inline-steps { grid-template-columns:1fr; }
  .settings-guide-steps { display:none; }
}
@media(max-width:700px){
  .settings-page-head { padding:1rem; }
  .settings-page-head .page-title { font-size:1.3rem; }
  .settings-mobile-navigation { position:relative; display:grid; gap:.32rem; }
  .settings-mobile-navigation-label { display:flex; align-items:center; gap:.38rem; padding-left:.15rem; color:#64748b; font-size:.63rem; font-weight:850; letter-spacing:.075em; text-transform:uppercase; }
  .settings-mobile-select { width:100%; min-height:54px; padding:.7rem 5.6rem .7rem 2.85rem !important; border:1px solid #bfdbfe !important; border-radius:14px !important; background:#fff !important; color:#172554; font-size:1rem !important; font-weight:800; line-height:1.2; appearance:none; -webkit-appearance:none; box-shadow:0 2px 8px rgba(37,99,235,.08); }
  .settings-mobile-select-icon { position:absolute; z-index:1; left:.9rem; bottom:.98rem; color:#2563eb; pointer-events:none; }
  .settings-mobile-select-action { position:absolute; z-index:1; right:2.45rem; bottom:1.12rem; color:#2563eb; font-size:.73rem; font-weight:800; pointer-events:none; }
  .settings-mobile-select-chevron { position:absolute; z-index:1; right:.9rem; bottom:.97rem; color:#2563eb; pointer-events:none; }
  .settings-mobile-select:focus { outline:none; border-color:#7c3aed !important; box-shadow:0 0 0 3px rgba(124,58,237,.14); }
  .settings-guide { grid-template-columns:auto minmax(0,1fr); padding:.9rem; }
  .settings-guide-badge,.settings-guide-progress { grid-column:1/-1; justify-self:stretch; }
  .settings-guide-progress { grid-template-columns:auto 1fr; justify-items:start; align-items:center; }
  .settings-card-heading { flex-wrap:wrap; }
  .settings-required-legend,.settings-status-pill { margin-left:44px; }
  .settings-field-group { padding:.8rem; }
  .settings-logo-field { align-items:flex-start; flex-direction:column; }
  .settings-save-bar { position:static; }
  .settings-save-bar .btn { width:100%; }
}
.supervision-embedded {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

.ficha-economy-card { display:grid; gap:.8rem; padding:1rem !important; }
.ficha-economy-card-heading { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.ficha-economy-card-heading > span { display:inline-flex; align-items:center; gap:.42rem; color:#065f46; font-size:.95rem; font-weight:850; }
.ficha-economy-card-heading > span svg { padding:.3rem; border-radius:9px; color:#047857; background:#d1fae5; box-sizing:content-box; }
.ficha-economy-card-heading small { max-width:570px; color:#64748b; font-size:.7rem; line-height:1.4; text-align:right; }
.ficha-economy-flow-switch { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.65rem; }
.ficha-economy-flow-switch > button { display:flex; align-items:center; gap:.7rem; min-height:66px; padding:.7rem .8rem; border:1px solid #dbe5f2; border-radius:13px; color:#475569; background:#fff; text-align:left; cursor:pointer; transition:.16s ease; }
.ficha-economy-flow-switch > button:hover { border-color:#94a3b8; background:#f8fafc; }
.ficha-economy-flow-switch > button.is-active:first-child { border-color:#a5b4fc; color:#3730a3; background:#eef2ff; box-shadow:0 7px 18px rgba(79,70,229,.08); }
.ficha-economy-flow-switch > button.is-active:last-child { border-color:#99f6e4; color:#115e59; background:#f0fdfa; box-shadow:0 7px 18px rgba(13,148,136,.08); }
.ficha-economy-flow-switch > button > span:last-child { display:grid; gap:.12rem; }
.ficha-economy-flow-switch b { font-size:.82rem; }
.ficha-economy-flow-switch small { color:#64748b; font-size:.67rem; }
.ficha-economy-flow-icon { display:grid; place-items:center; width:38px; height:38px; flex:0 0 38px; border-radius:11px; }
.ficha-economy-flow-icon.is-income { color:#4f46e5; background:#e0e7ff; }
.ficha-economy-flow-icon.is-outgoing { color:#0f766e; background:#ccfbf1; }
.ficha-economy-subsection { overflow:hidden; border:1px solid #dbe5f2; border-radius:11px; background:#fff; }
.ficha-economy-subsection summary { display:flex; align-items:center; justify-content:space-between; gap:.6rem; min-height:42px; padding:.55rem .7rem; color:#334155; background:#f8fafc; font-size:.76rem; font-weight:800; cursor:pointer; list-style:none; }
.ficha-economy-subsection summary::-webkit-details-marker { display:none; }
.ficha-economy-subsection summary span { display:inline-flex; align-items:center; gap:.4rem; }
.ficha-economy-subsection summary svg:last-child { transition:transform .16s ease; }
.ficha-economy-subsection[open] summary svg:last-child { transform:rotate(180deg); }
.ficha-economy-subsection-body { padding:.75rem; border-top:1px solid #e2e8f0; }
.ficha-evidence-purpose.is-photos { border-color:#bae6fd; color:#075985; background:#f0f9ff; }
.ficha-evidence-purpose.is-documents { border-color:#c7d2fe; color:#3730a3; background:#eef2ff; }
.ficha-evidence-purpose.is-dossier { border-color:#e9d5ff; color:#6b21a8; background:#faf5ff; }
/* Histórico separado */
.historical-toolbar{display:grid;grid-template-columns:minmax(280px,1fr) 190px 110px;gap:.65rem;padding:.8rem}.historical-search{display:flex;align-items:center;gap:.5rem;border:1px solid var(--border-color);border-radius:10px;padding:0 .75rem;background:var(--bg-card)}.historical-search input{border:0;outline:0;background:transparent;width:100%;padding:.7rem 0;color:var(--neutral-900)}.historical-list{padding:0;overflow:hidden}.historical-list-head{display:flex;justify-content:space-between;padding:.8rem 1rem;border-bottom:1px solid var(--border-color);font-size:.75rem}.historical-list-head span{color:var(--neutral-500)}.historical-row{width:100%;display:grid;grid-template-columns:145px minmax(240px,1fr) 120px 140px;align-items:center;gap:1rem;text-align:left;border:0;border-bottom:1px solid var(--border-color);background:transparent;padding:.8rem 1rem;color:var(--neutral-800);cursor:pointer}.historical-row:hover{background:#f8f7ff}.historical-row>span{display:grid;gap:.14rem}.historical-row small{color:var(--neutral-500)}.historical-source{font-size:.62rem;font-weight:900;letter-spacing:.08em;color:#7c3aed}.historical-status{font-size:.7rem;font-weight:750;color:#475569;background:#f1f5f9;border-radius:999px;padding:.3rem .55rem;justify-self:start}.historical-empty{min-height:240px;display:grid;place-content:center;justify-items:center;gap:.4rem;color:var(--neutral-400)}.historical-pagination{display:flex;justify-content:center;align-items:center;gap:1rem;padding:.8rem}.historical-detail{max-width:1120px}.historical-back{margin-bottom:.8rem}.historical-detail-hero{display:flex;align-items:center;gap:.8rem;padding:1.1rem 1.2rem;border:1px solid #ddd6fe;background:linear-gradient(125deg,#faf5ff,#fff);border-radius:16px}.historical-detail-hero>svg{color:#7c3aed}.historical-detail-hero div{display:grid;gap:.15rem}.historical-detail-hero span{font-size:.65rem;font-weight:900;letter-spacing:.09em;color:#7c3aed}.historical-detail-hero h1{margin:0;font-size:1.5rem}.historical-readonly{margin-left:auto;display:flex;align-items:center;gap:.35rem;background:#ede9fe;padding:.45rem .65rem;border-radius:999px}.historical-detail-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));padding:0;overflow:hidden}.historical-detail-grid>div{display:grid;gap:.22rem;padding:.85rem 1rem;border-right:1px solid var(--border-color);border-bottom:1px solid var(--border-color)}.historical-detail-grid span{font-size:.65rem;font-weight:800;color:var(--neutral-500);text-transform:uppercase;letter-spacing:.04em}.historical-raw summary{cursor:pointer;font-weight:750}.historical-raw pre{white-space:pre-wrap;word-break:break-word;max-height:480px;overflow:auto;font-size:.72rem}.header-search-group{padding:.4rem .7rem .2rem;font-size:.58rem;font-weight:900;letter-spacing:.1em;color:var(--neutral-400)}.header-invo-search-row.is-historical{background:#faf5ff}.alert-info{border:1px solid #bae6fd;background:#f0f9ff;color:#075985;padding:.7rem .85rem;border-radius:10px}.alert-error{border:1px solid #fecaca;background:#fef2f2;color:#991b1b;padding:.7rem .85rem;border-radius:10px}
@media(max-width:800px){.historical-toolbar{grid-template-columns:1fr}.historical-row{grid-template-columns:1fr;gap:.35rem}.historical-detail-grid{grid-template-columns:1fr 1fr}}
@media(max-width:520px){.historical-detail-grid{grid-template-columns:1fr}.historical-readonly{margin-left:0}.historical-detail-hero{align-items:flex-start;flex-wrap:wrap}}

/* Control de cartera en móvil: la prioridad queda destacada y el resto de
   indicadores se consulta en dos columnas para reducir el desplazamiento. */
@media (max-width:640px) {
  .exp-operations-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:.45rem !important; }
  .exp-operation-card:first-child { grid-column:1 / -1; }
  .exp-operation-card { min-width:0; min-height:72px; padding:.56rem !important; }
  .exp-operation-card:first-child { min-height:66px; }
  .exp-operation-label { font-size:.67rem !important; }
  .exp-operation-scope { white-space:normal; overflow:visible; text-overflow:clip; }
}

/* Agenda móvil: controles de periodo y alcance claros, sin huecos inútiles. */
/* El selector de período es la navegación principal de la agenda: aprovecha
   el ancho disponible y mantiene el foco centrado también fuera de móvil. */
.agenda-page-head .agenda-controls { flex:1 1 100%; display:grid; width:100%; gap:.55rem; }
.agenda-page-head .agenda-nav { display:grid; grid-template-columns:52px minmax(0,1fr) 52px; width:100%; align-items:center; gap:.5rem; }
.agenda-page-head .agenda-nav .btn { width:52px; min-width:52px; height:48px; padding:0; justify-content:center; }
.agenda-page-head .agenda-period-label { min-width:0; width:100%; display:grid; min-height:48px; place-items:center; padding:0 .4rem; }
.agenda-page-head .agenda-view-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; gap:.25rem; padding:.22rem; }
.agenda-page-head .agenda-view-tabs .btn { width:100%; min-height:48px; justify-content:center; }

@media (max-width:520px) {
  .agenda-page-head .agenda-controls { width:100%; }
  .agenda-page-head .agenda-nav { display:grid; grid-template-columns:48px minmax(0,1fr) 48px; width:100%; gap:.45rem; }
  .agenda-page-head .agenda-nav .btn { width:48px !important; min-width:48px; height:48px; padding:0 !important; justify-content:center; }
  .agenda-page-head .agenda-period-label { min-width:0; width:100%; display:grid; min-height:48px; place-items:center; padding:0 .25rem; font-size:.84rem; white-space:nowrap; }
  .agenda-page-head .agenda-view-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; gap:.25rem; padding:.22rem; }
  .agenda-page-head .agenda-view-tabs .btn { width:100% !important; min-height:48px; justify-content:center; padding:.45rem .25rem !important; }

  .agenda-scope-notice { display:grid; grid-template-columns:30px minmax(0,1fr); align-items:start; gap:.15rem .55rem; padding:.72rem .8rem; }
  .agenda-scope-notice-icon { display:grid; width:30px; height:30px; place-items:center; border-radius:9px; color:#0f766e; background:#dff8f2; }
  .agenda-scope-notice-copy { display:grid; min-width:0; gap:.12rem; line-height:1.35; }
  .agenda-scope-notice-copy strong { color:#17645e; font-size:.78rem; }
  .agenda-scope-notice-copy span { color:#4b746f; font-size:.7rem; }
  .agenda-scope-notice > .btn { grid-column:1 / -1; width:100%; min-height:38px; margin:.35rem 0 0 !important; justify-content:center; }
}

/* Centro de Supervisión */
.supervision-center{max-width:1600px}.supervision-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:1rem;padding:.2rem 0}.supervision-hero h1{margin:.15rem 0;font-size:1.65rem}.supervision-hero p{margin:0;color:var(--neutral-500)}.supervision-filters{display:grid;grid-template-columns:auto repeat(6,minmax(120px,1fr));gap:.55rem;align-items:end;padding:.75rem}.supervision-filters>span{display:flex;align-items:center;gap:.35rem;font-size:.72rem;font-weight:850;color:var(--neutral-500);align-self:center}.supervision-filters label{display:grid;gap:.2rem;font-size:.62rem;font-weight:800;color:var(--neutral-500)}.supervision-filters input,.supervision-filters select{width:100%;border:1px solid var(--border-color);border-radius:8px;background:var(--bg-card);padding:.5rem;color:var(--neutral-900);font-size:.72rem}.supervision-tabs{display:flex;gap:.3rem;overflow-x:auto;padding:.25rem;border-bottom:1px solid var(--border-color)}.supervision-tabs button{display:flex;align-items:center;gap:.35rem;white-space:nowrap;border:0;background:transparent;color:var(--neutral-500);font-weight:750;font-size:.7rem;padding:.55rem .65rem;border-radius:8px}.supervision-tabs button.active{background:var(--primary);color:#fff}.supervision-kpis{display:grid;grid-template-columns:repeat(6,minmax(120px,1fr));gap:.65rem}.supervision-kpis>.card{display:grid;gap:.25rem;padding:.8rem;text-align:left;border:1px solid var(--border-color);background:var(--bg-card);color:var(--neutral-900)}button.card.supervision-kpis{cursor:pointer}.supervision-kpis span{font-size:.68rem;color:var(--neutral-500);font-weight:750}.supervision-kpis strong{font-size:1.45rem}.supervision-kpis small{font-size:.62rem;color:var(--primary)}.supervision-columns{display:grid;grid-template-columns:1fr 1fr;gap:.7rem}.supervision-panel{padding:.9rem}.supervision-panel h2{font-size:.9rem;margin:0 0 .8rem}.supervision-bars{display:grid;gap:.55rem}.supervision-bars>div{display:grid;grid-template-columns:minmax(120px,1fr) 2fr auto;align-items:center;gap:.7rem;font-size:.72rem}.supervision-bars i{height:7px;background:var(--neutral-100);border-radius:99px;overflow:hidden}.supervision-bars b{display:block;height:100%;background:linear-gradient(90deg,#2563eb,#8b5cf6);border-radius:99px}.supervision-table{display:grid}.supervision-table>div,.supervision-table>button{display:grid;grid-template-columns:2fr repeat(4,1fr);gap:.5rem;align-items:center;text-align:left;border:0;border-top:1px solid var(--border-color);background:transparent;padding:.65rem;color:var(--neutral-800)}.supervision-table.companies>div,.supervision-table.companies>button{grid-template-columns:2fr repeat(3,1fr)}.supervision-table .head{border-top:0;background:var(--bg-soft);font-size:.62rem;font-weight:850;text-transform:uppercase;color:var(--neutral-500)}.supervision-table button:hover{background:var(--bg-soft)}.supervision-table .danger{color:var(--danger);font-weight:850}.robot-incident-list{display:grid}.robot-incident-list article{display:flex;align-items:center;gap:.6rem;padding:.65rem;border-top:1px solid var(--border-color)}.robot-incident-list article>span{display:grid;flex:1}.robot-incident-list small{color:var(--danger)}.robot-incident-list time{font-size:.65rem;color:var(--neutral-500)}
@media(max-width:1200px){.supervision-filters{grid-template-columns:repeat(3,1fr)}.supervision-kpis{grid-template-columns:repeat(3,1fr)}}
@media(max-width:760px){.supervision-filters,.supervision-kpis,.supervision-columns{grid-template-columns:1fr 1fr}.supervision-table{overflow-x:auto}.supervision-table>div,.supervision-table>button{min-width:680px}.supervision-hero{align-items:flex-start;flex-direction:column}}
@media(max-width:520px){.supervision-filters,.supervision-kpis,.supervision-columns{grid-template-columns:1fr}}
.economic-catalog-chips{display:flex;flex-wrap:wrap;gap:.45rem}.economic-catalog-chips button{display:grid;gap:.1rem;text-align:left;border:1px solid var(--border-color);background:var(--bg-soft);color:var(--neutral-500);border-radius:9px;padding:.45rem .65rem}.economic-catalog-chips button.active{border-color:#bfdbfe;background:#eff6ff;color:var(--neutral-900)}.economic-catalog-chips small{font-size:.62rem;color:var(--neutral-500)}
/* ── Gestión operativa del trabajo ───────────────────────────── */
.next-action-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:1rem;align-items:center;margin:.7rem 0;padding:.85rem 1rem;border:1px solid var(--border-color);border-radius:16px;background:var(--bg-card);box-shadow:0 6px 18px rgba(15,23,42,.05)}
.next-action-card-main{display:grid;gap:.18rem;min-width:0}.next-action-card-main>strong{font-size:.96rem;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.next-action-eyebrow,.next-action-meta{display:flex;align-items:center;gap:.35rem}.next-action-eyebrow{font-size:.68rem;font-weight:900;text-transform:uppercase;letter-spacing:.07em;color:#6d28d9}.next-action-meta{font-size:.74rem;color:#64748b}.next-action-controls,.next-action-quick{display:flex;gap:.4rem;align-items:center;flex-wrap:wrap}.next-action-form{display:grid;gap:.8rem}.next-action-type-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.45rem}.next-action-type{display:flex;align-items:center;justify-content:center;gap:.35rem;min-height:46px;border:1px solid #dbe3ef;border-radius:11px;background:#fff;color:#475569;font-weight:750;cursor:pointer}.next-action-type:hover,.next-action-type.active{border-color:#2563eb;background:#eff6ff;color:#1d4ed8}.next-action-date-shortcuts{display:flex;gap:.4rem}.next-action-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem}
.next-action-help{color:#64748b;font-size:.66rem;font-weight:500}.next-action-form-help{margin:0;padding:.55rem .65rem;border:1px solid #dbeafe;border-radius:10px;color:#475569;background:#eff6ff;font-size:.75rem;line-height:1.45}
.operational-work-page,.events-page{display:grid;gap:1rem}.page-title{display:flex;align-items:center;gap:.5rem}.operational-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.7rem}.operational-kpis>div,.operational-kpis>button{border:1px solid #dbeafe;border-radius:15px;background:#fff;padding:.8rem 1rem;text-align:left;box-shadow:0 7px 24px rgba(15,23,42,.04);cursor:default}.operational-kpis button{cursor:pointer}.operational-kpis span{display:block;color:#64748b;font-size:.7rem;font-weight:800;text-transform:uppercase;letter-spacing:.05em}.operational-kpis strong{display:block;font-size:1.55rem;color:#1d4ed8;margin-top:.18rem}.operational-kpis .danger{border-color:#fecaca;background:#fff7f7}.operational-kpis .danger strong{color:#dc2626}.operational-kpis .warning{border-color:#fde68a;background:#fffdf4}.operational-kpis .warning strong{color:#d97706}.operational-kpis .success{border-color:#bbf7d0;background:#f7fff9}.operational-kpis .success strong{color:#16a34a}.operational-filters{display:flex;align-items:center;gap:.55rem;padding:.65rem .8rem}.operational-filters>.form-input{width:auto;min-width:175px}.operational-search{display:flex;align-items:center;gap:.4rem;flex:1;min-width:210px;border:1px solid #dbe3ef;border-radius:10px;padding:0 .7rem;background:#fff}.operational-search input{border:0;outline:0;width:100%;min-height:38px;background:transparent}.operational-bucket{display:grid;gap:.45rem}.operational-bucket>header{display:flex;align-items:center;gap:.5rem}.operational-bucket>header>span{display:inline-flex;align-items:center;gap:.35rem;padding:.3rem .65rem;border-radius:999px;font-size:.75rem;font-weight:850}.operational-action-list{display:grid;border:1px solid #e2e8f0;border-radius:15px;overflow:hidden;background:#fff}.operational-action-row{display:grid;grid-template-columns:72px minmax(250px,1.5fr) minmax(120px,.65fr) minmax(150px,.8fr) auto;align-items:center;gap:.75rem;padding:.72rem .85rem;border-bottom:1px solid #edf2f7;cursor:pointer}.operational-action-row:last-child{border-bottom:0}.operational-action-row:hover{background:#f8fbff}.operational-action-time{font-weight:850;color:#1d4ed8}.operational-action-main{display:grid;gap:.12rem}.operational-action-main>span,.operational-action-origin,.operational-action-reason{font-size:.72rem;color:#64748b}.operational-action-origin{display:flex;align-items:center;gap:.25rem}.operational-action-reason{padding:.22rem .5rem;border-radius:7px;background:#f8fafc}.empty-operational{display:grid;place-items:center;gap:.5rem;min-height:150px;color:#64748b;text-align:center}
.events-selector{display:flex;align-items:end;gap:1rem}.events-selector label{min-width:300px}.events-selector label>span{display:block;font-size:.72rem;font-weight:800;margin-bottom:.3rem}.event-summary-copy{display:grid;gap:.12rem;padding-bottom:.25rem}.event-summary-copy span{font-size:.75rem;color:#64748b}.event-kpis{grid-template-columns:repeat(5,minmax(0,1fr))}.events-dashboard-grid{display:grid;grid-template-columns:1.35fr 1fr;gap:1rem}.card-section-head{display:flex;justify-content:space-between;align-items:center;gap:.7rem;padding-bottom:.65rem;border-bottom:1px solid #edf2f7}.card-section-head>div{display:flex;align-items:center;gap:.4rem}.card-section-head>span{font-size:.7rem;color:#64748b}.event-team-list,.event-alert-list,.event-case-list{display:grid;margin-top:.55rem}.event-team-row{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:.65rem;padding:.55rem 0;border-bottom:1px solid #edf2f7}.event-avatar{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:#eff6ff;color:#1d4ed8;font-size:.72rem;font-weight:900}.event-team-row>div{display:grid}.event-team-row small{font-size:.68rem;color:#64748b}.capacity-chip{padding:.25rem .5rem;border-radius:99px;font-size:.68rem;font-weight:800;background:#ecfdf5;color:#047857}.capacity-chip.warning{background:#fffbeb;color:#b45309}.capacity-chip.high,.capacity-chip.blocked{background:#fef2f2;color:#b91c1c}.event-alert-list>div{display:flex;align-items:flex-start;gap:.45rem;padding:.5rem 0;border-bottom:1px solid #edf2f7;color:#b45309}.event-alert-list>div>span{display:grid}.event-alert-list small{font-size:.65rem;color:#94a3b8}.event-empty{display:grid!important;place-items:center;color:#16a34a!important;border:0!important;min-height:90px}.event-case-list>button{display:grid;grid-template-columns:minmax(100px,.5fr) minmax(220px,1.5fr) auto;gap:.7rem;text-align:left;padding:.62rem;border:0;border-bottom:1px solid #edf2f7;background:#fff;cursor:pointer}.event-case-list>button:hover{background:#f8fbff}.event-case-list span{font-size:.75rem;color:#64748b}.event-case-list em{font-size:.7rem;color:#475569;font-style:normal}
@media(max-width:900px){.operational-kpis,.event-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.operational-action-row{grid-template-columns:56px minmax(0,1fr) auto}.operational-action-origin,.operational-action-reason{display:none}.events-dashboard-grid{grid-template-columns:1fr}.next-action-card{grid-template-columns:1fr}.next-action-controls{justify-content:flex-start}}
@media(max-width:560px){.operational-kpis,.event-kpis{grid-template-columns:1fr 1fr}.operational-filters,.events-selector{align-items:stretch;flex-direction:column}.operational-filters>.form-input,.events-selector label{width:100%;min-width:0}.operational-action-row{grid-template-columns:46px minmax(0,1fr)}.operational-action-row>.btn{grid-column:2;width:max-content}.next-action-type-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.next-action-form-grid{grid-template-columns:1fr}.event-case-list>button{grid-template-columns:1fr}.next-action-quick .btn{font-size:.72rem}}
.assignment-receipt-actions{display:flex;align-items:center;justify-content:flex-end;gap:.45rem;flex-wrap:wrap;margin:-.35rem 0 .7rem;padding:.45rem .65rem;border:1px solid #bfdbfe;border-radius:11px;background:#eff6ff}.assignment-receipt-actions>span{display:flex;align-items:center;gap:.35rem;margin-right:auto;color:#1e40af;font-size:.75rem;font-weight:750}
.portal-company-notes { margin: 0 0 .8rem; padding: 1rem; border: 1px solid #fdba74; border-left: 4px solid #ea580c; border-radius: 16px; background: linear-gradient(135deg,#fff,#fff7ed); box-shadow: 0 10px 28px rgba(154,52,18,.07); display:grid; gap:.75rem; }
.portal-company-notes__header { display:flex; align-items:center; justify-content:space-between; gap:.7rem; flex-wrap:wrap; }
.portal-company-notes__header h3 { margin:.1rem 0 0; display:flex; align-items:center; gap:.45rem; font-size:1rem; color:#7c2d12; }
.portal-company-notes__eyebrow { color:#c2410c; font-size:.64rem; font-weight:850; letter-spacing:.09em; }
.portal-company-notes__count,.portal-company-notes__done { display:inline-flex; align-items:center; gap:.3rem; border-radius:999px; padding:.25rem .65rem; font-size:.72rem; font-weight:850; }
.portal-company-notes__count { color:#9a3412; background:#ffedd5; border:1px solid #fdba74; }
.portal-company-notes__done { color:#166534; background:#f0fdf4; border:1px solid #bbf7d0; }
.portal-company-notes__help { margin:0; color:#64748b; font-size:.78rem; }
.portal-company-notes__message { padding:.55rem .7rem; border-radius:10px; background:#eff6ff; color:#1d4ed8; font-size:.78rem; font-weight:650; }
.portal-company-notes__list { display:grid; gap:.65rem; }
.portal-company-note { padding:.8rem; border:1px solid var(--note-border); border-radius:13px; background:var(--note-bg); display:grid; gap:.65rem; }
.portal-company-note__top { display:flex; justify-content:space-between; align-items:flex-start; gap:.6rem; flex-wrap:wrap; }
.portal-company-note__top>div { display:grid; gap:.1rem; }
.portal-company-note__top strong { color:#0f172a; font-size:.88rem; }
.portal-company-note__top span { color:#64748b; font-size:.7rem; }
.portal-company-note__status { display:inline-flex!important; align-items:center; gap:.3rem; color:var(--note-color)!important; border:1px solid var(--note-border); background:#fff; border-radius:999px; padding:.22rem .55rem; font-weight:800; }
.portal-company-note__body { white-space:pre-wrap; color:#334155; font-size:.84rem; line-height:1.5; padding:.65rem .75rem; background:rgba(255,255,255,.75); border-radius:10px; }
.portal-company-note__reply { display:flex; gap:.5rem; padding:.65rem .75rem; border-radius:10px; background:#fff; border:1px solid var(--note-border); color:#334155; }
.portal-company-note__reply>div { display:grid; gap:.2rem; }
.portal-company-note__reply b { font-size:.75rem; }
.portal-company-note__reply p { margin:0; white-space:pre-wrap; font-size:.8rem; }
.portal-company-note__reply small { color:#166534; font-size:.68rem; }
.portal-company-note__reply small.is-error { color:#b91c1c; }
.portal-company-note__action { justify-self:end; }
.portal-company-note__actions { display:flex; justify-content:flex-end; gap:.45rem; flex-wrap:wrap; }
.portal-company-note__composer { display:grid; gap:.65rem; padding:.8rem; border-radius:12px; background:#fff; border:1px solid #fdba74; }
.portal-company-note__composer label { display:grid; gap:.3rem; color:#475569; font-size:.75rem; font-weight:750; }
.portal-company-note__composer-actions { display:flex; justify-content:flex-end; gap:.45rem; flex-wrap:wrap; }
.portal-company-note__composer>small { color:#64748b; display:flex; align-items:center; gap:.3rem; }
@media (max-width: 720px) { .portal-company-notes { padding:.75rem; border-radius:13px; } .portal-company-note__action,.portal-company-note__actions .btn,.portal-company-note__composer-actions .btn { width:100%; justify-content:center; } }
/* ── Agenda UX de personas vinculadas al expediente ───────────────────── */
.contact-directory {
  display: grid;
  gap: .75rem;
  padding: 1rem 1.1rem;
  border-color: #dbe5f2;
  background: linear-gradient(135deg, #fff 0%, #fff 70%, #f5f3ff 100%);
}
.contact-directory-header,
.contact-directory-header-actions,
.contact-primary-summary,
.contact-person-heading,
.contact-person-details,
.contact-person-actions,
.contact-person-controls,
.contact-person-form-head,
.contact-person-form-actions,
.contact-person-checks,
.private-note-details summary {
  display: flex;
  align-items: center;
}
.contact-directory-header { justify-content: space-between; gap: 1rem; }
.contact-directory-header h3 { margin: .18rem 0 0; font-size: 1rem; color: var(--text-main); }
.contact-directory-eyebrow { display: inline-flex; align-items: center; gap: .35rem; color: #6d28d9; font-size: .67rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.contact-directory-header-actions { gap: .45rem; flex-wrap: wrap; justify-content: flex-end; }
.contact-directory-header-actions .btn { min-height: 36px; }
.contact-primary-summary { gap: .75rem; padding: .75rem .85rem; border: 1px solid #c4b5fd; border-radius: 13px; background: rgba(245,243,255,.78); }
.contact-primary-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px; color: #6d28d9; background: #ede9fe; }
.contact-primary-copy { display: grid; gap: .08rem; min-width: 0; flex: 1; }
.contact-primary-copy > span { color: #6d28d9; font-size: .65rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.contact-primary-copy strong { overflow: hidden; color: var(--text-main); font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.contact-primary-copy small { color: var(--neutral-500); font-size: .75rem; }
.contact-directory-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.contact-person-card { display: flex; align-items: flex-start; gap: .65rem; min-width: 0; padding: .75rem; border: 1px solid var(--border-color); border-radius: 12px; background: #fff; }
.contact-person-card.is-primary { border-color: #c4b5fd; box-shadow: inset 3px 0 #7c3aed; }
.contact-person-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; color: #475569; background: #f1f5f9; }
.contact-person-body { display: grid; gap: .4rem; min-width: 0; flex: 1; }
.contact-person-heading { gap: .3rem; flex-wrap: wrap; }
.contact-person-heading strong { font-size: .84rem; color: var(--text-main); }
.contact-role-chip,.contact-primary-chip,.contact-flag-chip { display: inline-flex; align-items: center; gap: .2rem; padding: .1rem .42rem; border-radius: 999px; font-size: .64rem; font-weight: 750; }
.contact-role-chip { color: #075985; border: 1px solid #bae6fd; background: #f0f9ff; }
.contact-primary-chip { color: #6d28d9; border: 1px solid #ddd6fe; background: #f5f3ff; }
.contact-flag-chip { color: #166534; border: 1px solid #bbf7d0; background: #f0fdf4; }
.contact-person-details { gap: .35rem .75rem; flex-wrap: wrap; color: var(--neutral-600); font-size: .73rem; }
.contact-person-note { margin: 0; color: var(--neutral-500); font-size: .72rem; line-height: 1.45; }
.contact-source-label { color: var(--neutral-400); font-size: .65rem; }
.contact-person-actions { gap: .35rem; flex-wrap: wrap; }
.contact-action { display: inline-flex; align-items: center; gap: .25rem; padding: .28rem .5rem; border: 1px solid #dbe5f2; border-radius: 8px; color: #334155; background: #fff; font-size: .7rem; font-weight: 700; text-decoration: none; }
.contact-action:hover { border-color: #a5b4fc; color: #4338ca; background: #eef2ff; }
.contact-action.is-whatsapp:hover { border-color: #86efac; color: #15803d; background: #f0fdf4; }
.contact-person-controls { gap: .25rem; margin-left: auto; }
.contact-primary-select,.contact-change-primary { display:inline-flex; align-items:center; justify-content:center; gap:.28rem; min-height:30px; padding:.3rem .52rem; border:1px solid #c4b5fd; border-radius:8px; color:#6d28d9; background:#f5f3ff; font:inherit; font-size:.68rem; font-weight:800; white-space:nowrap; cursor:pointer; }
.contact-primary-select:hover,.contact-change-primary:hover { border-color:#8b5cf6; background:#ede9fe; }
.contact-change-primary { flex:0 0 auto; }
.contact-icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid #e2e8f0; border-radius: 8px; color: #64748b; background: #fff; cursor: pointer; }
.contact-icon-btn:hover { color: #4f46e5; border-color: #c7d2fe; background: #eef2ff; }
.contact-icon-btn.is-danger:hover { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.contact-person-form { display: grid; gap: .75rem; padding: .9rem; border: 1px solid #c7d2fe; border-radius: 13px; background: #f8faff; }
.contact-person-form-head { justify-content: space-between; }
.contact-person-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.contact-person-form-grid label { display: grid; gap: .28rem; min-width: 0; }
.contact-person-form-grid label > span { color: #475569; font-size: .69rem; font-weight: 750; }
.contact-person-form-grid .is-wide { grid-column: span 3; }
.contact-person-checks { gap: 1rem; flex-wrap: wrap; }
.contact-person-checks label { display: inline-flex; align-items: center; gap: .38rem; color: #334155; font-size: .76rem; font-weight: 650; }
.contact-person-checks .is-primary-choice { padding:.38rem .55rem; border:1px solid #ddd6fe; border-radius:8px; color:#6d28d9; background:#f5f3ff; font-weight:800; }
.contact-person-form-actions { justify-content: flex-end; gap: .45rem; }
.contact-directory-message { padding: .55rem .7rem; border: 1px solid #fecaca; border-radius: 9px; color: #b91c1c; background: #fef2f2; font-size: .75rem; font-weight: 650; }
.private-note-details { padding-top: .2rem; border-top: 1px solid #eef2f7; }
.private-note-details summary { gap: .35rem; width: fit-content; color: #64748b; font-size: .72rem; font-weight: 700; cursor: pointer; }
.private-note-details p { margin: .45rem 0; color: var(--neutral-400); font-size: .68rem; }
.private-note-details textarea { min-height: 76px; margin-bottom: .4rem; font-size: .78rem; }
.operational-primary-contact { margin: -.15rem 0 .3rem; overflow: hidden; color: #475569; font-size: .7rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .contact-directory-list { grid-template-columns: 1fr; }
  .contact-person-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-person-form-grid .is-wide { grid-column: span 2; }
}

/* Formularios y visores de expediente: siempre pertenecen al viewport, no a
   la posición de scroll de la ficha. */
.contact-person-form.is-modal {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.contact-person-form.is-modal .contact-person-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contact-person-form.is-modal .contact-person-form-grid .is-wide {
  grid-column: span 2;
}

.contact-person-form-intro {
  margin: 0;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.5;
}

.timeline-note-preview { display: grid; gap: 0.9rem; }
.timeline-note-meta { display: flex; align-items: center; gap: 0.4rem; color: #94a3b8; font-size: 0.73rem; }
.timeline-note-content {
  min-height: 120px;
  max-height: 48dvh;
  overflow: auto;
  padding: 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
}
.timeline-note-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.5rem; }
.timeline-note-navigation button:last-child { justify-self: end; }
.timeline-note-navigation span { color: #64748b; font-size: 0.72rem; }
.timeline-note-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(2, 6, 23, 0.96);
  backdrop-filter: blur(8px);
}

.photo-lightbox-stage {
  display: grid;
  place-items: center;
  width: min(86vw, 1400px);
  height: calc(100dvh - 92px);
  padding: 18px 72px 54px;
}

.photo-lightbox-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
  pointer-events: none;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
}

.photo-lightbox-nav,
.photo-lightbox-close {
  position: absolute;
  z-index: 12;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.94);
  color: #0f172a;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  cursor: pointer;
}

.photo-lightbox-nav {
  top: 50%;
  width: 52px;
  height: 52px;
  transform: translateY(-50%);
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}
.photo-lightbox-nav.is-prev { left: 18px; }
.photo-lightbox-nav.is-next { right: 18px; }
.photo-lightbox-nav:disabled { opacity: .25; cursor: default; }
.photo-lightbox-close { top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 12px; }
.photo-lightbox-footer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 58px;
  padding: 0.6rem 1rem;
  background: rgba(2, 6, 23, 0.78);
  color: rgba(255,255,255,.88);
  backdrop-filter: blur(8px);
  font-size: .8rem;
}

@media (max-width: 640px) {
  .contact-person-form.is-modal .contact-person-form-grid { grid-template-columns: 1fr; }
  .contact-person-form.is-modal .contact-person-form-grid .is-wide { grid-column: span 1; }
  .contact-person-checks { align-items: stretch; flex-direction: column; }
  .contact-person-form-actions { position: sticky; bottom: 0; padding-top: .65rem; background: var(--bg-card); }
  .timeline-note-content { max-height: 42dvh; }
  .timeline-note-navigation { grid-template-columns: 1fr 1fr; }
  .timeline-note-navigation span { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .photo-lightbox-stage { width: 100vw; height: calc(100dvh - 72px); padding: 54px 8px 76px; }
  .photo-lightbox-nav { top: auto; bottom: 82px; width: 44px; height: 44px; background: rgba(255,255,255,.88); }
  .photo-lightbox-nav.is-prev { left: 12px; }
  .photo-lightbox-nav.is-next { right: 12px; }
  .photo-lightbox-close { top: 10px; right: 10px; }
  .photo-lightbox-footer { min-height: 66px; padding: .55rem .7rem; }
}
@media (max-width: 640px) {
  .exp-operations-heading { align-items:flex-start; flex-direction:column; gap:.25rem; }
  .exp-operations-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  .contact-directory { padding: .8rem; }
  .contact-directory-header { align-items: flex-start; flex-direction: column; }
  .contact-directory-header-actions { width: 100%; justify-content: stretch; }
  .contact-directory-header-actions .btn { flex: 1; justify-content: center; }
  .contact-primary-summary { align-items: flex-start; flex-wrap: wrap; }
  .contact-primary-summary .contact-person-actions { width: 100%; padding-left: 47px; }
  .contact-change-primary { margin-left:47px; }
  .contact-person-card { position: relative; }
  .contact-person-controls { position:static; width:100%; justify-content:flex-end; flex-wrap:wrap; }
  .contact-person-heading { padding-right:0; }
  .contact-person-form-grid { grid-template-columns: 1fr; }
  .contact-person-form-grid .is-wide { grid-column: span 1; }
}
/* ── Panel de entrada al expediente según el rol ───────────────────────── */
.ficha-role-cockpit {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(420px, .9fr);
  grid-template-areas:
    "context context"
    "action action"
    "state state"
    "work contacts";
  gap: .75rem;
  margin: .7rem 0;
  padding: .85rem;
  border: 1px solid #dde5f2;
  border-radius: 20px;
  background: #fafbfd;
  box-shadow: 0 14px 38px rgba(51,65,85,.06);
}
.cockpit-action-area { grid-area: action; display:grid; gap:.75rem; min-width: 0; align-items: stretch; }
.ficha-role-cockpit:not(.is-perito) .cockpit-action-area { grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); }
.cockpit-action-area .next-action-card { height: 100%; margin: 0; box-sizing: border-box; }
.cockpit-action-area .perito-follow-up { height: 100%; box-sizing: border-box; display: flex; }
.cockpit-action-area .perito-follow-up-summary { flex: 1; }
.cockpit-role-context { grid-area: context; display: flex; align-items: center; gap: .55rem; min-width: 0; min-height: 26px; padding: 0 .2rem 0 .55rem; border-left: 3px solid #7c3aed; }
.cockpit-role-context > span { color: #6d28d9; font-size: .64rem; font-weight: 900; letter-spacing: .075em; text-transform: uppercase; }
.cockpit-role-context > strong { color: #334155; font-size: .78rem; line-height: 1.35; }
.cockpit-role-context > small { margin-left: auto; color: #94a3b8; font-size: .63rem; }
.cockpit-state-area { grid-area: state; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; min-width: 0; align-self: start; }
.cockpit-work-area { grid-area: work; min-width: 0; }
.cockpit-contacts-area { grid-area: contacts; min-width: 0; container-type: inline-size; }
.cockpit-action-area .next-action-card,
.cockpit-work-area .perito-workflow,
.cockpit-work-area > .card,
.cockpit-contacts-area .contact-directory { height: 100%; margin: 0; box-sizing: border-box; }
.cockpit-action-area .next-action-card { min-height: 0; padding: .85rem 1rem; }
.ficha-role-cockpit .btn { align-items: center; justify-content: center; }
.cockpit-state-area .modality-control { height: 100%; min-height: 60px; padding: .55rem .8rem !important; box-sizing: border-box; border-color: var(--border-color) !important; background: var(--bg-card) !important; }
.cockpit-state-area .modality-control > div:first-child { flex: 1; }
.cockpit-status-control { display: grid; align-content: center; gap: .35rem; min-height: 60px; padding: .55rem .8rem; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); box-sizing: border-box; }
.cockpit-mini-title { display: flex; align-items: center; gap: .35rem; color: #64748b; font-size: .64rem; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
.cockpit-status-row { display: grid; grid-template-columns: minmax(120px,.65fr) minmax(180px,1fr); align-items: center; gap: .8rem; }
.cockpit-status-current { display: inline-flex; align-items: center; gap: .35rem; min-width: 0; max-width: 100%; padding: .34rem .6rem; overflow: hidden; border: 1px solid; border-radius: 999px; font-size: .73rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box; }
.cockpit-status-current i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; }
.cockpit-status-select { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.cockpit-status-select select { width: 100%; min-width: 0; min-height: 36px; padding: .3rem 2rem .3rem .65rem; border: 1px solid #cbd5e1; border-radius: 9px; color: #334155; background: #fff; font: inherit; font-size: .72rem; font-weight: 700; appearance: none; cursor: pointer; }
.cockpit-status-select svg { position: absolute; right: .45rem; pointer-events: none; color: #64748b; }
.cockpit-status-control > small { color: #94a3b8; font-size: .62rem; }
.cockpit-work-area .operational-summary-card { padding: 0; border: 0; background: transparent; box-shadow: none; }
.cockpit-work-area .operational-summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: .55rem; }
.cockpit-work-area .operational-summary-grid > div { padding: .72rem; }
.operational-summary-item { min-height: 94px; border: 1px solid #dbe5f2; border-radius: 14px; background: #fff; box-sizing: border-box; }
.operational-summary-item.is-contact { border-color: #bfdbfe; background: linear-gradient(145deg,#fff,#eff6ff); }
.operational-summary-item.is-deadline { border-color: #c7d2fe; background: linear-gradient(145deg,#fff,#eef2ff); }
.operational-summary-item.is-evidence { border-color: #a5f3fc; background: linear-gradient(145deg,#fff,#ecfeff); }
.operational-summary-item.is-alerts { border-color: #bbf7d0; background: linear-gradient(145deg,#fff,#f0fdf4); }
.operational-summary-item.is-alerts.has-alerts { border-color: #fde68a; background: linear-gradient(145deg,#fff,#fffbeb); }
.operational-area-title { display: flex; align-items: center; gap: .38rem; margin-bottom: .45rem; color: #64748b; font-size: .64rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
/* Criterio de color: los titulos de area van SIEMPRE en neutro; el color
   queda reservado al estado (alertas ambar) y a la marca (acciones). */
.operational-summary-item.is-alerts.has-alerts .operational-area-title { color: #b45309; }
.operational-alert-action { display:inline-flex; align-items:center; gap:.18rem; flex:0 0 auto; margin-left:auto; color:inherit; font-size:.62rem; font-weight:850; white-space:nowrap; }
.cockpit-work-area .operational-photo-summary { padding: .72rem; border: 1px solid #a5f3fc; }
.cockpit-work-area .operational-photo-summary-body { min-height: 43px; }
.cockpit-contacts-area .contact-directory { border-color: #ddd6fe; box-shadow: inset 0 3px #8b5cf6; }
.cockpit-contacts-area .contact-directory-header { align-items: center; }
.cockpit-contacts-area .contact-directory-header-actions .btn { min-height: 34px; }
.ficha-role-cockpit.is-control .cockpit-role-context { border-left-color: #7c3aed; }
.ficha-role-cockpit.is-office .cockpit-role-context { border-left-color: #2563eb; }
.ficha-role-cockpit.is-office .cockpit-role-context > span { color: #1d4ed8; }
.ficha-role-cockpit.is-perito .cockpit-role-context { border-left-color: #0d9488; }
.ficha-role-cockpit.is-perito .cockpit-role-context > span { color: #0f766e; }
.ficha-role-cockpit.is-perito {
  grid-template-areas:
    "context context"
    "work work"
    "action contacts"
    "state contacts";
}
.ficha-role-cockpit.is-perito .cockpit-state-area { grid-template-columns: repeat(2,minmax(0,1fr)); }
.ficha-role-cockpit.is-perito .perito-workflow { padding: .85rem 1rem .7rem; }
.ficha-role-cockpit.is-perito .perito-workflow-steps { gap: .4rem; }
.ficha-role-cockpit.is-perito .perito-workflow-step { padding: .52rem; }

/* Seguimiento inmediato que sustituye las anotaciones dispersas del perito. */
.perito-follow-up { overflow:hidden; border:1px solid #dbe5f2; border-radius:14px; background:#fff; }
.perito-follow-up-summary { display:flex; align-items:center; gap:.7rem; min-height:58px; padding:.65rem .75rem; }
.perito-follow-up-icon { display:grid; place-items:center; width:36px; height:36px; flex:0 0 36px; border-radius:11px; color:#475569; background:#f1f5f9; }
.perito-follow-up-copy { display:grid; gap:.08rem; min-width:0; flex:1; }
.perito-follow-up-copy small { color:#64748b; font-size:.61rem; font-weight:850; letter-spacing:.06em; text-transform:uppercase; }
.perito-follow-up-copy strong { color:#0f172a; font-size:.82rem; }
.perito-follow-up-copy > span { color:#64748b; font-size:.7rem; line-height:1.45; }
.perito-follow-up-contact-limit { display:grid; gap:.08rem; max-width:260px; padding:.4rem .55rem; border:1px solid #fecaca; border-radius:9px; color:#991b1b; background:#fef2f2; }
.perito-follow-up-contact-limit b { font-size:.7rem; }
.perito-follow-up-contact-limit span { font-size:.63rem; line-height:1.3; }
.perito-follow-up.is-blue .perito-follow-up-icon { color:#1d4ed8; background:#dbeafe; }
.perito-follow-up.is-green .perito-follow-up-icon { color:#047857; background:#d1fae5; }
.perito-follow-up.is-red .perito-follow-up-icon { color:#b91c1c; background:#fee2e2; }
.perito-follow-up.is-amber .perito-follow-up-icon { color:#b45309; background:#fef3c7; }
.perito-follow-up.is-orange .perito-follow-up-icon { color:#c2410c; background:#ffedd5; }
.perito-follow-up.is-violet .perito-follow-up-icon { color:#6d28d9; background:#ede9fe; }
.perito-follow-up-editor { display:grid; gap:.7rem; padding:.75rem; border-top:1px solid #e2e8f0; background:#f8fafc; }
.modal .perito-follow-up-editor { padding:0; border-top:0; background:transparent; }
.perito-follow-up-editor-intro { display:grid; gap:.15rem; padding:.55rem .65rem; border:1px solid #ddd6fe; border-radius:9px; color:#4c1d95; background:#f5f3ff; }
.perito-follow-up-editor-intro strong { font-size:.74rem; }
.perito-follow-up-editor-intro span { color:#6b7280; font-size:.67rem; line-height:1.4; }
.perito-follow-up-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.4rem; }
.perito-follow-up-options button { display:flex; align-items:center; justify-content:flex-start; gap:.35rem; min-height:38px; padding:.4rem .55rem; border:1px solid #dbe5f2; border-radius:9px; color:#475569; background:#fff; font:inherit; font-size:.69rem; font-weight:750; cursor:pointer; }
.perito-follow-up-options button.active { border-color:#818cf8; color:#3730a3; background:#eef2ff; box-shadow:inset 3px 0 #6366f1; }
.perito-follow-up-editor > label { display:grid; gap:.3rem; }
.perito-follow-up-editor > label > span { color:#475569; font-size:.68rem; font-weight:750; }
.perito-follow-up-actions { display:flex; justify-content:flex-end; gap:.45rem; flex-wrap:wrap; }

@container (max-width: 620px) {
  .contact-directory-list { grid-template-columns: 1fr; }
  .contact-person-form-grid { grid-template-columns: 1fr; }
  .contact-person-form-grid .is-wide { grid-column: span 1; }
}

@media (max-width: 1180px) {
  .ficha-role-cockpit { grid-template-columns: minmax(0,1fr) minmax(320px,.85fr); }
  .cockpit-work-area .operational-summary-grid { grid-template-columns: 1fr; }
  .cockpit-state-area,
  .ficha-role-cockpit.is-perito .cockpit-state-area { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .ficha-role-cockpit,
  .ficha-role-cockpit.is-perito {
    grid-template-columns: 1fr;
    grid-template-areas: "context" "action" "state" "work" "contacts";
    padding: .5rem;
    border-radius: 15px;
  }
  .cockpit-work-area .operational-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ficha-role-cockpit.is-perito .cockpit-state-area { grid-template-columns: 1fr; }
  .cockpit-role-context { align-items: flex-start; flex-direction: column; gap: .15rem; }
  .cockpit-role-context > small { margin-left: 0; }
}
@media (max-width: 560px) {
  .cockpit-work-area .operational-summary-grid { grid-template-columns: 1fr; }
  .cockpit-status-row { align-items: stretch; flex-direction: column; }
  .cockpit-status-select, .cockpit-status-select select { width: 100%; }
  .perito-follow-up-summary { align-items:flex-start; flex-wrap:wrap; }
  .perito-follow-up-copy { min-width:calc(100% - 50px); }
  .perito-follow-up-contact-limit { width:100%; max-width:none; margin-left:43px; }
  .perito-follow-up-summary > .btn { width:100%; }
  .perito-follow-up-options { grid-template-columns:1fr; }
}

/* ── Jerarquía de lectura de la ficha ────────────────────────────────────
   1. próxima actuación, 2. datos necesarios para actuar, 3. consulta. */
.ficha-role-cockpit:not(.is-perito) {
  grid-template-columns: 1fr;
  grid-template-areas:
    "context"
    "action"
    "state"
    "work"
    "contacts";
  gap: .62rem;
  padding: .78rem;
  background: linear-gradient(180deg, #fbfcff 0%, #f7f9fc 100%);
  box-shadow: 0 12px 30px rgba(15,23,42,.045);
}
.ficha-role-cockpit:not(.is-perito) .cockpit-role-context {
  position:relative;
  min-height: 22px;
  padding-left: .5rem;
  padding-right:9.5rem;
}
.cockpit-management-edit { position:absolute; top:-.3rem; right:0; min-height:34px !important; padding:.35rem .65rem !important; color:#5b21b6; border-color:#ddd6fe; background:#fff; }
.ficha-role-cockpit:not(.is-perito) .cockpit-role-context > strong {
  font-size: .74rem;
}
.ficha-role-cockpit:not(.is-perito) .cockpit-role-context > small {
  opacity: .78;
}
.ficha-role-cockpit:not(.is-perito) .cockpit-action-area {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .72fr);
  align-items: start;
}
.ficha-role-cockpit:not(.is-perito) .cockpit-action-area .next-action-card,
.ficha-role-cockpit:not(.is-perito) .cockpit-action-area .perito-follow-up { height:auto; }
.ficha-role-cockpit:not(.is-perito) .cockpit-action-area .next-action-card {
  min-height: 88px;
  border-color: transparent;
  background: radial-gradient(circle at 92% 0%, rgba(255,255,255,.09), transparent 42%), var(--px-navy, #1a2130);
  box-shadow: 0 16px 36px rgba(26,33,48,.24);
  color: #fff;
}
.ficha-role-cockpit:not(.is-perito) .perito-follow-up {
  min-height: 88px;
  border-color: #e2e8f0;
}
.ficha-role-cockpit:not(.is-perito) .perito-follow-up-summary {
  height: auto;
  min-height: 86px;
  box-sizing: border-box;
}
.ficha-role-cockpit:not(.is-perito) .cockpit-state-area {
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: .6rem;
}
.ficha-role-cockpit:not(.is-perito) .cockpit-state-area .modality-control,
.ficha-role-cockpit:not(.is-perito) .cockpit-status-control {
  min-height: 62px;
  height: auto;
  padding: .55rem .72rem !important;
  border-color: #dbe5f2 !important;
  background: #fff !important;
  box-shadow: none;
}
.ficha-role-cockpit:not(.is-perito) .cockpit-status-control {
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: .7rem;
}
.ficha-role-cockpit:not(.is-perito) .cockpit-status-control > small { display:none; }
.ficha-role-cockpit:not(.is-perito) .cockpit-status-row {
  grid-template-columns: minmax(115px,.55fr) minmax(180px,1fr);
}
.management-readonly-state { display:grid; align-content:center; gap:.22rem; min-height:62px; padding:.6rem .85rem; border:1px solid #dbe5f2; border-radius:13px; background:#fff; }
.management-readonly-state small { color:#64748b; font-size:.62rem; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.management-readonly-state strong { color:#1e293b; font-size:.82rem; }
.management-readonly-state.is-modality { }
.management-readonly-state.is-status { }
.management-edit-modal { display:grid; gap:.75rem; }
.management-edit-modal-intro { padding:.65rem .75rem; border:1px solid #dbeafe; border-radius:11px; color:#1e40af; background:#eff6ff; font-size:.78rem; }
.management-edit-modal-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.7rem; }
.ficha-role-cockpit:not(.is-perito) .cockpit-work-area .operational-summary-grid {
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: .5rem;
}
.ficha-role-cockpit:not(.is-perito) .operational-summary-item {
  min-height: 82px;
  padding: .62rem !important;
  border-color: #e2e8f0;
  background: #fff;
}
.ficha-role-cockpit:not(.is-perito) .operational-summary-item.is-alerts.has-alerts {
  border-color: #fde68a;
  background: #fffbeb;
}
.cockpit-secondary-details {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #fff;
}
.cockpit-secondary-details > summary {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 52px;
  padding: .55rem .72rem;
  list-style: none;
  cursor: pointer;
  box-sizing: border-box;
}
.cockpit-secondary-details > summary::-webkit-details-marker { display:none; }
.cockpit-secondary-icon {
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  flex:0 0 34px;
  border-radius:10px;
  color:#6d28d9;
  background:#f3e8ff;
}
.cockpit-secondary-details > summary > span:nth-child(2) { display:grid; gap:.05rem; min-width:0; }
.cockpit-secondary-details > summary small { color:#7c3aed; font-size:.59rem; font-weight:850; letter-spacing:.06em; text-transform:uppercase; }
.cockpit-secondary-details > summary strong { overflow:hidden; color:#1e293b; font-size:.75rem; text-overflow:ellipsis; white-space:nowrap; }
.cockpit-secondary-meta { margin-left:auto; color:#64748b; font-size:.68rem; }
.cockpit-secondary-chevron { color:#64748b; transition:transform .2s ease; }
.cockpit-secondary-details[open] .cockpit-secondary-chevron { transform:rotate(180deg); }
.cockpit-secondary-details[open] > summary { border-bottom:1px solid #e2e8f0; background:#fafafa; }
.cockpit-secondary-details > .contact-directory { margin: .65rem; height:auto; }

.ficha-company-workspace { margin:.7rem 0; }
.ficha-secondary-tools {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:.6rem;
}
.ficha-secondary-tool {
  display:grid;
  grid-template-columns:36px minmax(0,1fr) auto;
  align-items:center;
  gap:.65rem;
  min-height:62px;
  padding:.65rem .75rem;
  border:1px solid #e2e8f0;
  border-radius:14px;
  color:#334155;
  background:#fff;
  box-shadow:0 5px 16px rgba(15,23,42,.03);
  text-align:left;
  transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease;
}
.ficha-secondary-tool:hover { transform:translateY(-1px); border-color:#cbd5e1; box-shadow:0 8px 20px rgba(15,23,42,.06); }
.ficha-secondary-tool-icon { display:grid; place-items:center; width:36px; height:36px; border-radius:11px; }
.ficha-secondary-tool.is-contacts .ficha-secondary-tool-icon { color:#7c3aed; background:#f3e8ff; }
.ficha-secondary-tool.is-company .ficha-secondary-tool-icon { color:#c2410c; background:#fff7ed; }
.ficha-secondary-tool.is-preview .ficha-secondary-tool-icon { color:#1d4ed8; background:#eff6ff; }
.ficha-secondary-tool-copy { display:grid; gap:.12rem; min-width:0; }
.ficha-secondary-tool-copy small { color:#64748b; font-size:.62rem; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.ficha-secondary-tool-copy strong { overflow:hidden; color:#1e293b; font-size:.76rem; line-height:1.25; text-overflow:ellipsis; white-space:nowrap; }
.ficha-secondary-tool-action { color:#64748b; font-size:.68rem; font-weight:750; }
.ficha-secondary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.65rem; align-items:start; }
.ficha-secondary-grid > details { margin:0; }
.ficha-secondary-contact-access > summary { min-height:56px; }
.ficha-secondary-contact-access[open] { grid-column:1/-1; }
.ficha-secondary-grid > .ficha-secondary-details[open] { grid-column:1/-1; }
.ficha-secondary-details {
  overflow:hidden;
  border:1px solid #e2e8f0;
  border-radius:14px;
  background:#fff;
  box-shadow:0 5px 15px rgba(15,23,42,.025);
}
.ficha-secondary-details > summary {
  display:flex;
  align-items:center;
  gap:.7rem;
  min-height:56px;
  padding:.65rem .8rem;
  list-style:none;
  cursor:pointer;
}
.ficha-secondary-details > summary::-webkit-details-marker { display:none; }
.ficha-secondary-details-icon { display:grid; place-items:center; width:34px; height:34px; flex:0 0 34px; border-radius:10px; color:#c2410c; background:#fff7ed; }
.ficha-secondary-details > summary > span:nth-child(2) { display:grid; gap:.08rem; }
.ficha-secondary-details > summary strong { color:#1e293b; font-size:.82rem; }
.ficha-secondary-details > summary small { color:#64748b; font-size:.67rem; }
.ficha-secondary-details-hint { margin-left:auto; color:#94a3b8; font-size:.64rem; }
.ficha-secondary-details > summary > svg { color:#64748b; transition:transform .2s ease; }
.ficha-secondary-details[open] > summary > svg { transform:rotate(180deg); }
.ficha-secondary-details[open] > summary { border-bottom:1px solid #e2e8f0; background:#fffaf5; }
.ficha-secondary-details-body { display:grid; gap:.65rem; padding:.65rem; }

.ficha-evidence-unified { display:grid; gap:.8rem; }
.ficha-evidence-unified-group { overflow:hidden; border:1px solid #dbe5ef; border-radius:14px; background:#fff; }
.ficha-evidence-unified-group.is-photos { border-left:3px solid #0ea5e9; }
.ficha-evidence-unified-group.is-documents { border-left:3px solid #6366f1; }
.ficha-evidence-unified-heading { display:flex; align-items:center; justify-content:space-between; gap:.6rem; padding:.62rem .8rem; border-bottom:1px solid #e8edf3; background:#f8fafc; }
.ficha-evidence-unified-heading span { display:inline-flex; align-items:center; gap:.4rem; color:#334155; font-size:.76rem; font-weight:800; }
.ficha-evidence-unified-heading b { display:grid; place-items:center; min-width:24px; height:24px; border-radius:999px; color:#475569; background:#e9eef5; font-size:.68rem; }
.ficha-evidence-unified-group > :not(.ficha-evidence-unified-heading) { margin:0; border:0; border-radius:0; box-shadow:none; }

/* La navegación interior se comporta como selector de zona de trabajo, no
   como una línea de enlaces secundarios. */
.ficha-subnav {
  justify-content:flex-start;
  gap:.65rem;
  min-height:54px;
  padding:.42rem .65rem;
  border-color:#dbe5f2;
  background:rgba(255,255,255,.96);
  box-shadow:0 8px 22px rgba(15,23,42,.045);
}
.ficha-subnav-label { flex:0 0 auto; min-width:max-content; }
.ficha-subnav-tabs { justify-content:center; gap:.3rem; }
.ficha-subnav-tab { min-height:38px; padding:.48rem .85rem; border-color:transparent; }
.ficha-subnav-tab.active { border-color:#c4b5fd; background:#f5f3ff; color:#6d28d9; box-shadow:0 3px 10px rgba(109,40,217,.08); }
.ficha-subnav-personas.active { color:#7c3aed; }
.ficha-subnav-notas-oficina.active { color:#2563eb; border-color:#bfdbfe; background:#eff6ff; }
.ficha-subnav-gestion-cierre.active { color:#047857; border-color:#a7f3d0; background:#ecfdf5; }
.ficha-subnav-actividad.active { color:#c2410c; border-color:#fed7aa; background:#fff7ed; }

.conversation-modal-context { display:flex; align-items:center; gap:.45rem; padding:.5rem .65rem; border:1px solid #ddd6fe; border-radius:10px; color:#4c1d95; background:#f5f3ff; }
.conversation-modal-context strong { font-size:.78rem; }
.conversation-modal-context span { overflow:hidden; color:#64748b; font-size:.72rem; text-overflow:ellipsis; white-space:nowrap; }
.modal .conversation-drawer-content { display:grid; gap:.65rem; width:100%; max-height:min(72dvh,760px); padding:0; overflow:hidden; border:0; box-shadow:none; }
.modal .conversation-drawer-content .ficha-message-timeline { min-height:220px; max-height:38dvh !important; }
.modal .conversation-drawer-content .ficha-message-editor { max-height:32dvh; overflow-y:auto; }

@media (max-width: 1180px) {
  .ficha-role-cockpit:not(.is-perito) .cockpit-work-area .operational-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .ficha-role-cockpit:not(.is-perito) .cockpit-role-context { padding-right:.5rem; padding-bottom:2.7rem; }
  .cockpit-management-edit { top:auto; right:auto; bottom:0; left:.5rem; }
  .management-edit-modal-grid { grid-template-columns:1fr; }
  .ficha-secondary-tools { grid-template-columns:1fr; }
  .ficha-role-cockpit:not(.is-perito) .cockpit-action-area,
  .ficha-role-cockpit:not(.is-perito) .cockpit-state-area { grid-template-columns:1fr; }
  .ficha-secondary-details-hint { display:none; }
  .ficha-secondary-grid { grid-template-columns:1fr; }
  .ficha-secondary-contact-access[open],
  .ficha-secondary-grid > .ficha-secondary-details[open] { grid-column:auto; }
  .ficha-subnav { align-items:flex-start; flex-direction:column; gap:.3rem; }
  .ficha-subnav-tabs { justify-content:flex-start; width:100%; }
}
@media (max-width: 560px) {
  .ficha-role-cockpit:not(.is-perito) .cockpit-work-area .operational-summary-grid { grid-template-columns:1fr; }
  .cockpit-secondary-meta { display:none; }
}
/* Flujo pericial: el informe es el trabajo principal y los módulos de consulta
   quedan como información secundaria personalizable. */
.perito-report-workspace {
  display: grid;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid #c4b5fd;
  border-radius: 20px;
  background: linear-gradient(145deg, #ffffff 0%, #faf8ff 55%, #f5f3ff 100%);
  box-shadow: 0 16px 38px rgba(76, 29, 149, 0.08);
}

.perito-report-workspace-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0.2rem;
}

.perito-report-workspace-head > div:first-child > span {
  color: #6d28d9;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.perito-report-workspace-head h2 {
  margin: 0.15rem 0 0.1rem;
  color: #172033;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.perito-report-workspace-head p {
  margin: 0;
  color: #64748b;
  font-size: 0.82rem;
}

.perito-report-steps {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.perito-report-steps span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0.28rem 0.58rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 750;
}

.perito-report-steps b,
.perito-report-stage-label > b {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: #fff;
  font-size: 0.7rem;
}

.perito-report-steps .is-evidence b { background: #0f766e; }
.perito-report-steps .is-draft b { background: #4f46e5; }
.perito-report-steps .is-final b { background: #7c3aed; }

.perito-report-stage {
  display: grid;
  gap: 0.65rem;
  padding: 0.8rem;
  border: 1px solid;
  border-radius: 16px;
  scroll-margin-top: 132px;
}

.perito-report-stage.is-draft { border-color: #c7d2fe; background: #f8faff; }
.perito-report-stage.is-final { border-color: #ddd6fe; background: #fcfaff; }
.perito-report-stage.is-draft .perito-report-stage-label > b { background: #4f46e5; }
.perito-report-stage.is-final .perito-report-stage-label > b { background: #7c3aed; }

.perito-report-stage-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.perito-report-stage-label span { display: grid; gap: 0.05rem; }
.perito-report-stage-label strong { color: #1e293b; font-size: 0.88rem; }
.perito-report-stage-label small { color: #64748b; font-size: 0.72rem; }
.perito-report-stage > .card { margin: 0; box-shadow: none; }

.management-request-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #64748b !important;
  background: #fff !important;
  border-color: #e2e8f0 !important;
  font-weight: 650 !important;
}

.management-request-compact.is-pending {
  min-height: 34px;
  padding: 0.35rem 0.65rem;
  border: 1px solid #fde68a;
  border-radius: 9px;
  background: #fffbeb !important;
  color: #a16207 !important;
  font-size: 0.75rem;
}

.perito-view-settings { display: grid; gap: 0.7rem; }
.perito-view-settings > p { margin: 0 0 0.1rem; color: #64748b; font-size: 0.82rem; line-height: 1.5; }
.perito-view-setting-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
}
.perito-view-setting-row:hover { border-color: #c4b5fd; background: #faf8ff; }
.perito-view-setting-row input { width: 18px; height: 18px; accent-color: #6d28d9; }
.perito-view-setting-row span { display: grid; gap: 0.1rem; }
.perito-view-setting-row strong { color: #1e293b; font-size: 0.83rem; }
.perito-view-setting-row small { color: #64748b; font-size: 0.72rem; }

@media (max-width: 900px) {
  .perito-report-workspace { padding: 0.7rem; border-radius: 15px; }
  .perito-report-workspace-head { align-items: stretch; flex-direction: column; }
  .perito-report-steps { justify-content: flex-start; }
  .perito-report-steps span { flex: 1 1 140px; }
}

/* Archivos y evidencias: selector compacto (menos scroll, misma funcion) */
.ficha-evidence-tabs-slim { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.ficha-evidence-tab-slim { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--neutral-600); border-radius: 999px; padding: .35rem .75rem; font-size: .76rem; font-weight: 700; cursor: pointer; transition: all .15s; }
.ficha-evidence-tab-slim b { background: var(--bg-soft); border-radius: 999px; padding: 0 .4rem; font-size: .68rem; color: var(--neutral-500); }
.ficha-evidence-tab-slim.is-active { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.ficha-evidence-tab-slim.is-active b { background: rgba(255,255,255,.22); color: #fff; }
.ficha-evidence-unified { display: grid; gap: .8rem; }


/* Vista "Todo" compacta: cabecera pequena de documentos */
.document-workspace-header.is-unified { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ficha-evidence-unified .ficha-work-photos-card { border-top: none; padding: 0; box-shadow: none; background: transparent; }

/* ══ Control de gerencia con el lenguaje visual del panel de control ══
   Tarjeta protagonista en azul marino (Próxima tarea) y tarjetas blancas
   de lectura rápida con el arco decorativo del dashboard. */

/* Héroe: la Próxima tarea manda, como 'Expedientes activos' en el panel. */
.ficha-role-cockpit.is-control .next-action-card {
  border: 0;
  background: radial-gradient(circle at 92% 0%, rgba(255,255,255,.09), transparent 42%), var(--px-navy, #1a2130);
  color: #fff;
  box-shadow: 0 16px 36px rgba(26,33,48,.24);
}
.ficha-role-cockpit.is-control .next-action-card .next-action-eyebrow { color: #ffd84d; }
.ficha-role-cockpit:not(.is-perito) .next-action-card .next-action-card-main > strong { color: #fff; }
.ficha-role-cockpit.is-control .next-action-card .next-action-help { color: #94a3b8; }
.ficha-role-cockpit.is-control .next-action-card .next-action-meta { color: #e2e8f0; }
.ficha-role-cockpit.is-control .next-action-card .btn {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.22);
  color: #fff;
}
.ficha-role-cockpit.is-control .next-action-card .btn.btn-primary {
  background: #7c3aed;
  border-color: #7c3aed;
}

/* Tarjetas de lectura rápida: mismo chrome que las del dashboard. */
.ficha-role-cockpit.is-control .perito-follow-up,
.ficha-role-cockpit.is-control .management-readonly-state,
.operational-summary-card.is-manager .operational-summary-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 4px 16px rgba(15,23,42,.035);
}
.ficha-role-cockpit.is-control .management-readonly-state::after,
.operational-summary-card.is-manager .operational-summary-item:not(.is-alerts)::after {
  position: absolute;
  right: -24px;
  bottom: -34px;
  width: 82px;
  height: 82px;
  border: 10px solid rgba(100,116,139,.08);
  border-radius: 50%;
  content: '';
  pointer-events: none;
}
.ficha-role-cockpit.is-control .management-readonly-state strong { font-size: 1rem; }
.operational-summary-card.is-manager .operational-summary-item .operational-area-title { letter-spacing: .07em; }
.operational-summary-card.is-manager .operational-summary-item.is-alerts.has-alerts {
  border-color: #fde68a;
  background: linear-gradient(125deg, #fffbeb 0%, var(--bg-card) 70%);
}

/* Gestión: Modalidad/Estado viven en la fila de datos del resumen; los
   duplicados de la zona superior sobran. */
.ficha-role-cockpit.is-control .cockpit-state-area { display: none; }
/* Sin alertas: una línea discreta, no un tarjetón vacío. */
.operational-summary-card.is-manager .operational-summary-item.is-alerts.is-slim { display: flex; align-items: center; gap: .6rem; padding: .4rem .85rem; min-height: 0; }
.operational-summary-card.is-manager .operational-summary-item.is-alerts.is-slim .operational-area-title { margin-bottom: 0; }
/* La fila de 5 datos pliega con orden en pantallas menores. */
@media (max-width: 1250px) { .operational-summary-card.is-manager .operational-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }
@media (max-width: 860px) { .operational-summary-card.is-manager .operational-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Gestión: fila de decisión en 3 columnas — Tarea (navy) · Situación · Alertas */
.ficha-role-cockpit.is-control .cockpit-action-area {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}
.cockpit-action-area .cockpit-alertas {
  height: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-card);
  padding: .65rem .85rem;
  box-shadow: 0 4px 16px rgba(15,23,42,.035);
}
.cockpit-action-area .cockpit-alertas.has-alerts {
  border-color: #fde68a;
  background: linear-gradient(125deg, #fffbeb 0%, var(--bg-card) 70%);
}
@media (max-width: 1250px) {
  .ficha-role-cockpit:not(.is-perito) .cockpit-action-area { grid-template-columns: minmax(0, 1fr); }
  .ficha-role-cockpit.is-control .cockpit-action-area { grid-template-columns: minmax(0, 1fr); }
  .cockpit-action-area .next-action-card,
  .cockpit-action-area .cockpit-alertas { grid-column: 1 / -1; height: auto; }
  /* Dentro de las tarjetas: texto arriba a todo el ancho, botones debajo. */
  .cockpit-action-area .next-action-card { grid-template-columns: minmax(0, 1fr); }
  .cockpit-action-area .next-action-card .next-action-controls { justify-content: flex-start; }
  .cockpit-action-area .perito-follow-up-summary { flex-wrap: wrap; }
  .cockpit-action-area .perito-follow-up-summary > .btn { margin-left: 0; }
}

/* ══ Tabla de expedientes 100% adaptable: misma tabla en todas las
   pantallas; a menos anchura, se ocultan columnas secundarias en vez de
   cortar el contenido. Orden de sacrificio: Modalidad → Próxima actuación
   → anchos compactos. ══ */
@media (max-width: 1680px) {
  .exp-table-wrapper .col-modalidad { display: none; }
  .exp-table-wrapper .responsive-table { min-width: 1160px !important; }
}
@media (max-width: 1500px) {
  .exp-table-wrapper .col-next { display: none; }
  .exp-table-wrapper .responsive-table { min-width: 990px !important; }
}
@media (max-width: 1370px) {
  .exp-table-wrapper .responsive-table { min-width: 880px !important; }
  .exp-table-wrapper .responsive-table th { width: auto !important; }
  .exp-table-wrapper .responsive-table th:first-child { width: 38px !important; }
  .exp-table-wrapper .responsive-table th:last-child { width: 104px !important; }
  .exp-table-wrapper .responsive-table td { height: 84px; padding-left: .5rem; padding-right: .5rem; }
}
/* Nivel esenciales (portátil pequeño, 1121-1250px): cabe TODO sin cortes.
   Se retira lo accesorio dentro de las celdas: casilla de selección, botón
   de reenviar email, chip de seguimiento y línea de detalle del plazo (el
   dato completo sigue en el tooltip y en la ficha). */
@media (max-width: 1250px) {
  .exp-table-wrapper .responsive-table { min-width: 720px !important; }
  .exp-table-wrapper .responsive-table th:first-child,
  .exp-table-wrapper .responsive-table td:first-child { display: none; }
  .exp-table-wrapper .assignment-mail-btn { display: none !important; }
  .exp-table-wrapper .follow-up-badge { display: none !important; }
  .exp-table-wrapper .deadline-detail { display: none; }
  .exp-table-wrapper .responsive-table th:last-child { width: 92px !important; }
  .exp-table-wrapper .responsive-table td { height: 76px; padding-left: .45rem; padding-right: .45rem; }
  .exp-table-wrapper .responsive-table td select { min-width: 0; width: 100%; max-width: 100%; }
}

/* ══ CONTRATO RESPONSIVE GLOBAL ══
   Reglas defensivas para TODA la app: ningún contenido debe provocar
   scroll horizontal de página ni desbordar su tarjeta.
   Niveles oficiales: >1500 completo · 1251-1500 medio (columnas
   secundarias fuera) · 1121-1250 esenciales · 769-1120 tarjetas · <769
   móvil. Toda pantalla nueva debe respetarlos. */
img, svg, video, canvas { max-width: 100%; }
.card { min-width: 0; }
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.app-shell { overflow-x: hidden; }

/* ══ Tarjetas de expedientes (tablet y móvil): tarjetas DE VERDAD ══
   Separación clara entre expedientes, dos por fila en tablet, una en
   móvil; y las tarjetas de Control de cartera pliegan en vez de
   estrujarse. */
@media (max-width: 1120px) {
  .exp-operations-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important; }
  .exp-cards-mobile {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    padding: 0.9rem;
    background: #f1f5f9;
  }
  .exp-card-mobile {
    border: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    padding: 0.85rem 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  .exp-card-mobile:hover { border-color: #c4b5fd; box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1); }
}
@media (max-width: 768px) {
  .exp-cards-mobile { grid-template-columns: 1fr; width: 100%; min-width: 0; padding: 0.7rem; overflow: hidden; }
  .exp-card-mobile { width: 100%; min-width: 0; max-width: 100%; overflow: hidden; box-sizing: border-box; }
  .exp-card-mobile-top { min-width: 0; }
  .exp-card-mobile-meta { flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .exp-card-estado { max-width: 44%; overflow: hidden; text-overflow: ellipsis; }
  .exp-card-mobile-name { overflow: hidden; color: var(--text-main); font-size: 0.9rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .exp-card-mobile-company { display: flex; align-items: center; min-width: 0; gap: 0.35rem; overflow: hidden; color: var(--neutral-500); font-size: 0.73rem; }
  .exp-card-mobile-company > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .exp-card-assignment,
  .exp-card-assignment > div,
  .exp-card-assignment > div > div { min-width: 0; max-width: 100%; }
  .exp-card-assignment .assignment-mail-btn { display: none !important; }
  .exp-card-mobile-footer { min-width: 0; }
  .exp-card-mobile-footer > :first-child { min-width: 0; max-width: 100%; overflow: hidden; }
}

/* Cartera móvil: cinco indicadores legibles sin convertir la portada en una
   lista vertical. Esta regla va después de la adaptación tablet para que no
   la sobrescriba el layout intermedio. */
@media (max-width: 640px) {
  .exp-operations .exp-operations-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .48rem !important;
  }
  .exp-operations .exp-operation-card,
  .exp-operations .exp-operation-card:first-child {
    grid-column: auto !important;
    min-width: 0;
    min-height: 92px;
    padding: .62rem !important;
  }
  .exp-operations .exp-operation-copy { min-width: 0; }
  .exp-operations .exp-operation-label { font-size: .69rem !important; line-height: 1.1; }
  .exp-operations .exp-operation-count { font-size: 1.55rem !important; line-height: 1; }
  .exp-operations .exp-operation-scope { font-size: .62rem !important; line-height: 1.15; }
  .exp-operations .exp-operation-icon { flex: 0 0 auto; align-self: center; }
}

/* ==========================================================================
   VISTA TRABAJO DEL PERITO (ficha, modo compacto) — sept 2026
   Un solo recorrido: Ahora → Datos → Peritación → Evidencias → Informe, con
   Comunicaciones fijas a la derecha y el asistente IA como panel lateral.
   ========================================================================== */

/* -- Panel "Ahora": fusiona fases, próxima tarea, situación y recepción -- */
.ficha-role-cockpit.is-ahora {
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
  grid-template-areas: "work action" "receipt receipt";
  gap: .8rem;
  padding: 1rem 1.05rem;
  border-color: transparent;
  background: var(--px-navy, #16213e);
  box-shadow: 0 18px 44px rgba(22, 33, 62, .22);
  color: #fff;
}
.ficha-role-cockpit.is-ahora .cockpit-action-area { grid-template-columns: minmax(0, 1fr); align-content: start; }
.ficha-role-cockpit.is-ahora .cockpit-action-area > * { min-width: 0; }
.ficha-role-cockpit.is-ahora .perito-workflow { padding: .2rem .2rem 0; border: 0; background: transparent; box-shadow: none; color: #fff; }
.ficha-role-cockpit.is-ahora .perito-workflow-eyebrow { color: #aab4d4; }
.ficha-role-cockpit.is-ahora .perito-workflow h2 { color: #fff; }
.ficha-role-cockpit.is-ahora .perito-workflow-head p { color: #c3cbe6; }
.ficha-role-cockpit.is-ahora .perito-workflow-progress-label strong { color: #fff; }
.ficha-role-cockpit.is-ahora .perito-workflow-progress-label span { color: #aab4d4; }
.ficha-role-cockpit.is-ahora .perito-workflow-actions .btn-primary { background: #fff; border-color: #fff; color: var(--px-navy, #16213e); }
.ficha-role-cockpit.is-ahora .perito-workflow-bar { background: rgba(255,255,255,.14); }
.ficha-role-cockpit.is-ahora .perito-workflow-bar span { background: #7dd3a8; }
.ficha-role-cockpit.is-ahora .perito-workflow-step { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.07); color: #dfe5f5; }
.ficha-role-cockpit.is-ahora .perito-workflow-step:hover { background: rgba(255,255,255,.13); }
.ficha-role-cockpit.is-ahora .perito-workflow-step strong { color: inherit; }
.ficha-role-cockpit.is-ahora .perito-workflow-step small { color: rgba(255,255,255,.62); }
.ficha-role-cockpit.is-ahora .perito-workflow-step-icon { background: rgba(255,255,255,.12); color: #fff; border-color: transparent; }
.ficha-role-cockpit.is-ahora .perito-workflow-step.is-done { background: rgba(125,211,168,.14); border-color: rgba(125,211,168,.3); color: #d7f5e4; }
.ficha-role-cockpit.is-ahora .perito-workflow-step.is-done .perito-workflow-step-icon { background: #7dd3a8; color: #0b3320; }
.ficha-role-cockpit.is-ahora .perito-workflow-step.is-active { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.45); color: #fff; }
.ficha-role-cockpit.is-ahora .perito-workflow-step.is-active .perito-workflow-step-icon { background: #fff; color: var(--px-navy, #16213e); }
.ficha-role-cockpit.is-ahora .perito-workflow-foot { border-top-color: rgba(255,255,255,.14); }
.ficha-role-cockpit.is-ahora .perito-workflow-foot > div { color: #c8f5d6; }
.ficha-role-cockpit.is-ahora .perito-workflow-foot > div.has-alerts { color: #ffd7a8; }
.ficha-role-cockpit.is-ahora .perito-workflow-foot small { color: rgba(255,255,255,.6); }
.ficha-role-cockpit.is-ahora .perito-workflow-foot > button { color: #fff; border-color: rgba(255,255,255,.3); background: transparent; }
.ficha-role-cockpit.is-ahora .assignment-receipt-actions {
  grid-area: receipt; margin: 0; padding: .55rem .8rem;
  border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.06);
}
.ficha-role-cockpit.is-ahora .assignment-receipt-actions > span { color: #dfe5f5; }
.ficha-role-cockpit.is-ahora .assignment-receipt-actions .btn { color: #fff; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.08); }
.ficha-role-cockpit.is-ahora .assignment-receipt-actions .btn-primary { color: var(--px-navy, #16213e); border-color: #fff; background: #fff; }

/* -- Numeración de fases en las tarjetas (misma que el panel Ahora) -- */
.ficha-step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 8px; background: #ede9fe; color: #6d28d9; font-size: .74rem; font-weight: 800; }
.ficha-step-num.is-done { background: #dcfce7; color: #15803d; }
.ficha-step-num.is-now { background: #6d28d9; color: #fff; }
.ficha-chip { display: inline-flex; align-items: center; gap: .3rem; margin-left: .35rem; padding: .18rem .6rem; border-radius: 999px; font-size: .68rem; font-weight: 750; letter-spacing: .01em; white-space: nowrap; }
.ficha-chip.is-ok { background: #dcfce7; color: #15803d; }
.ficha-chip.is-acc { background: #ede9fe; color: #6d28d9; }
.ficha-chip.is-warn { background: #fef3c7; color: #b45309; }

/* -- Subnav: botón del asistente -- */
.ficha-subnav { position: relative; }
.ficha-subnav-ai { margin-left: auto; gap: .35rem; border-color: #ddd6fe; color: #6d28d9; background: #f5f3ff; white-space: nowrap; }
.ficha-subnav-ai.is-open { background: #6d28d9; border-color: #6d28d9; color: #fff; }

/* -- Datos: fila de la persona de contacto -- */
.ficha-persona-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .9rem; padding-top: .85rem; border-top: 1px dashed var(--border-color); }
.ficha-persona-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: #ede9fe; color: #6d28d9; font-size: .74rem; font-weight: 800; }
.ficha-persona-who { display: grid; gap: .05rem; min-width: 0; flex: 1 1 200px; }
.ficha-persona-who strong { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficha-persona-who small { color: var(--neutral-500, #64748b); font-size: .74rem; font-variant-numeric: tabular-nums; }
.ficha-persona-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-left: auto; }
.ficha-persona-actions .btn { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; text-decoration: none; }
.ficha-persona-wa { border-color: #25d366 !important; color: #128c4a !important; background: #e9fbef !important; }

/* -- Peritación: controles de modalidad y estado en la cabecera de la tarjeta -- */
.ficha-peritacion-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: .85rem; }

/* -- Informe: pestañas previo/final y pie de cierre -- */
.ficha-informe-card .ficha-info-header { flex-wrap: wrap; gap: .6rem; }
.ficha-informe-panel > .card,
.ficha-informe-panel > section.card,
.ficha-informe-panel > div > .card,
.ficha-informe-panel > div > section.card { margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; }
.ficha-informe-empty { display: grid; gap: .45rem; justify-items: start; padding: 1rem 1.1rem; border: 1px dashed #c4b5fd; border-radius: 12px; background: #faf5ff; }
.ficha-informe-empty strong { font-size: .9rem; }
.ficha-informe-empty span { color: var(--neutral-600, #475569); font-size: .8rem; line-height: 1.45; max-width: 60ch; }
.ficha-informe-foot { margin-top: 1rem; padding-top: .9rem; border-top: 1px dashed var(--border-color); }
.ficha-informe-foot-title { display: inline-flex; align-items: center; gap: .45rem; margin-bottom: .6rem; font-size: .86rem; font-weight: 800; }
.ficha-informe-foot > .ficha-close-card,
.ficha-informe-foot > div > .ficha-close-card { margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; }
.ficha-junior-close { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .7rem; padding: .7rem .9rem; border: 1px solid #fde68a; border-radius: 12px; background: #fffbeb; }
.ficha-junior-close span { flex: 1 1 260px; color: #92400e; font-size: .8rem; line-height: 1.45; }

/* -- Columna lateral de comunicaciones -- */
.ficha-rail { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.ficha-rail-card .ficha-evidence-tabs-slim { margin-bottom: .8rem; }
.ficha-evidence-tab-slim b.is-alert { background: #dc2626; color: #fff; }
.ficha-rail-panel > .card,
.ficha-rail-panel > section.card,
.ficha-rail-panel > section,
.ficha-rail-panel > div > .card { margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; }

/* -- Rejilla: una columna principal ordenada + carril fijo -- */
@media (min-width: 1181px) {
  .ficha-grid.ficha-perito-flow { grid-template-columns: minmax(0, 1fr) minmax(330px, 380px); gap: 1rem; align-items: start; }
  .ficha-grid.ficha-perito-flow > .ficha-left,
  .ficha-grid.ficha-perito-flow > .ficha-right { display: contents; }
  .ficha-grid.ficha-perito-flow #sec-peritación { order: 1; grid-column: 1; }
  .ficha-grid.ficha-perito-flow #sec-fotos { order: 2; grid-column: 1; }
  .ficha-grid.ficha-perito-flow #sec-informe { order: 3; grid-column: 1; }
  .ficha-grid.ficha-perito-flow .ficha-rail { order: 0; grid-column: 2; grid-row: 1 / span 3; position: sticky; top: 76px; max-height: calc(100vh - 90px); overflow: auto; }
}
@media (max-width: 1180px) {
  .ficha-grid.ficha-perito-flow { grid-template-columns: minmax(0, 1fr); }
  .ficha-grid.ficha-perito-flow > .ficha-left,
  .ficha-grid.ficha-perito-flow > .ficha-right { display: contents; }
  .ficha-grid.ficha-perito-flow #sec-peritación { order: 1; grid-column: 1; }
  .ficha-grid.ficha-perito-flow #sec-fotos { order: 2; grid-column: 1; }
  .ficha-grid.ficha-perito-flow #sec-informe { order: 3; grid-column: 1; }
  .ficha-grid.ficha-perito-flow .ficha-rail { order: 4; grid-column: 1; }
}
.ficha-grid.ficha-perito-flow > .ficha-left > *,
.ficha-grid.ficha-perito-flow > .ficha-right > * { min-width: 0; }

/* -- Asistente IA: panel lateral + botón flotante -- */
.ficha-ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 900;
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .7rem 1.05rem; border: 0; border-radius: 999px;
  background: #6d28d9; color: #fff; font: inherit; font-size: .84rem; font-weight: 800;
  box-shadow: 0 12px 30px rgba(109,40,217,.35); cursor: pointer;
}
.ficha-ai-fab:hover { background: #5b21b6; }
.ficha-ai-drawer {
  position: fixed; top: 0; right: 0; z-index: 1200;
  display: flex; flex-direction: column;
  width: min(540px, 100vw); height: 100vh; height: 100dvh;
  background: var(--bg-card, #fff);
  box-shadow: -16px 0 48px rgba(15,23,42,.2);
  transform: translateX(105%);
  transition: transform .25s ease;
  visibility: hidden;
}
.ficha-ai-drawer.is-open { transform: none; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .ficha-ai-drawer { transition: none; } }
.ficha-ai-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border-color); background: #faf5ff; }
.ficha-ai-drawer-head > span { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; color: #4c1d95; }
.ficha-ai-drawer-head strong { font-size: .9rem; }
.ficha-ai-drawer-head small { flex-basis: 100%; color: #6b7280; font-size: .72rem; }
.ficha-ai-drawer-head .btn { padding: .35rem .5rem; }
.ficha-ai-drawer-body { flex: 1; min-height: 0; overflow: auto; padding: .8rem 1rem 1rem; }
.ficha-ai-drawer-body > .pericial-ai,
.ficha-ai-drawer-body > div > .pericial-ai { margin: 0; border: 0; box-shadow: none; }
@media (max-width: 640px) {
  .ficha-ai-fab span { display: none; }
  .ficha-ai-fab { padding: .8rem; }
}
@media (max-width: 1180px) {
  .ficha-role-cockpit.is-ahora { grid-template-columns: 1fr; grid-template-areas: "work" "action" "receipt"; }
}
@media (max-width: 860px) {
  .ficha-role-cockpit.is-ahora .cockpit-action-area { grid-template-columns: 1fr; }
  .ficha-peritacion-controls { grid-template-columns: 1fr; }
}

/* -- Ajustes tras la primera prueba real de la vista Trabajo -- */
/* Próxima tarea y Situación se apilan en el panel Ahora: texto arriba, botones debajo. */
.ficha-role-cockpit.is-ahora .next-action-card { grid-template-columns: minmax(0, 1fr); gap: .6rem; align-items: start; }
.ficha-role-cockpit.is-ahora .next-action-controls,
.ficha-role-cockpit.is-ahora .next-action-quick { display: flex; flex-wrap: wrap; gap: .4rem; }
.ficha-role-cockpit.is-ahora .next-action-controls .btn { flex: 1 1 auto; justify-content: center; }
.ficha-role-cockpit.is-ahora .perito-follow-up-summary { flex-wrap: wrap; }
.ficha-role-cockpit.is-ahora .perito-follow-up-summary > .btn { margin-left: auto; }
/* La ficha nunca genera scroll horizontal. */
.ficha-role-cockpit, .ficha-grid, .ficha-subnav { max-width: 100%; }
/* Asistente IA: es la herramienta central del perito, tiene que verse. */
.ficha-subnav-ai { padding: .5rem .95rem; border: 0; color: #fff; background: linear-gradient(135deg, #7c3aed, #db2777); box-shadow: 0 8px 20px rgba(124,58,237,.3); font-size: .82rem; }
.ficha-subnav-ai:hover { filter: brightness(1.06); }
.ficha-subnav-ai.is-open { background: #1e1b4b; box-shadow: none; }
.ficha-ai-fab { padding: .85rem 1.25rem; font-size: .92rem; background: linear-gradient(135deg, #7c3aed, #db2777); box-shadow: 0 14px 34px rgba(124,58,237,.45); }
.ficha-ai-fab:hover { filter: brightness(1.06); background: linear-gradient(135deg, #7c3aed, #db2777); }
/* Grabaciones plegadas dentro de Peritación. */
.ficha-transcripts-toggle { display: flex; align-items: center; gap: .45rem; width: 100%; margin-top: .9rem; padding: .6rem .75rem; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-soft, #f8fafc); color: var(--text-main, #0f172a); font: inherit; font-size: .8rem; font-weight: 750; text-align: left; cursor: pointer; }
.ficha-transcripts-toggle b { padding: 0 .45rem; border-radius: 999px; background: #ede9fe; color: #6d28d9; font-size: .7rem; }
.ficha-transcripts-toggle small { margin-left: auto; color: var(--neutral-500, #64748b); font-weight: 600; }
/* Conversación del equipo en línea (carril de comunicaciones). */
.ficha-messages-inline .conversation-modal-context,
.ficha-messages-inline .ficha-message-header { display: none; }
.ficha-messages-inline .ficha-messages-card { padding: 0; border: 0; box-shadow: none; background: transparent; }
.ficha-messages-inline .ficha-message-timeline { max-height: 380px !important; }
@media (max-width: 640px) { .ficha-transcripts-toggle small { display: none; } }

.ficha-role-cockpit.is-ahora { overflow-x: clip; }

/* -- Asistente IA como ventana centrada (en vez de panel lateral) -- */
.ficha-ai-backdrop { position: fixed; inset: 0; z-index: 1190; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.ficha-ai-drawer {
  top: 50%; left: 50%; right: auto; bottom: auto;
  width: min(960px, 94vw); height: min(86vh, 860px);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .35);
  transform: translate(-50%, -50%) scale(.96); opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}
.ficha-ai-drawer.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.ficha-ai-drawer-head { background: linear-gradient(135deg, #f5f3ff, #fdf2f8); }
.ficha-ai-drawer-head em { font-style: normal; font-size: .78rem; font-weight: 700; color: #6d28d9; padding: .1rem .5rem; border-radius: 999px; background: #ede9fe; }
.ficha-ai-drawer-body { padding: .6rem 1rem 1rem; }
.pericial-ai.is-chat-only { padding: 0; }
.pericial-ai.is-chat-only .pericial-ai__chat { display: flex; flex-direction: column; min-height: 0; }
.pericial-ai.is-chat-only .pericial-ai__quick-actions { flex-wrap: wrap; }
@media (max-width: 640px) {
  .ficha-ai-drawer { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
}

/* -- Sección Informes centralizada (tarjeta Informe de la vista Trabajo) -- */
.ficha-informe-hint { margin: -.2rem 0 .8rem; color: var(--neutral-500, #64748b); font-size: .78rem; line-height: 1.5; }
.ficha-inline-link { display: inline-flex; align-items: center; gap: .2rem; padding: .05rem .45rem; border: 0; border-radius: 999px; background: #ede9fe; color: #6d28d9; font: inherit; font-size: .74rem; font-weight: 800; cursor: pointer; vertical-align: baseline; }
.ficha-informe-card .pericial-ai.is-mode-reports { margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }
.ficha-informe-panel > .pericial-ai + .card,
.ficha-informe-panel > .pericial-ai + div > .card { margin-top: 1rem !important; padding: .85rem 1rem !important; border: 1px solid #c7d2fe !important; border-radius: 12px !important; background: #f8faff !important; }

/* -- Conversación del equipo dentro del carril: versión compacta y limpia -- */
.ficha-messages-inline .ficha-message-timeline { max-height: 340px !important; padding: .1rem !important; }
.ficha-messages-inline .ficha-message-editor { padding: .75rem .8rem; }
.ficha-messages-inline .ficha-message-editor-heading { flex-wrap: wrap; gap: .25rem .6rem; }
.ficha-messages-inline .ficha-message-editor-heading kbd { display: none; }
.ficha-messages-inline .ficha-message-editor-heading strong { font-size: .84rem; }
.ficha-messages-inline .ficha-message-editor-heading span { font-size: .72rem; }
.ficha-messages-inline .ficha-note-types legend span { display: none; }
.ficha-messages-inline .ficha-note-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
.ficha-messages-inline .ficha-note-type { min-height: 40px; padding: .4rem .55rem; font-size: .74rem; }
.ficha-messages-inline .ficha-note-type small { display: none; }
.ficha-messages-inline .ficha-message-dropzone { display: flex; align-items: center; gap: .5rem; padding: .5rem .65rem; }
.ficha-messages-inline .ficha-message-dropzone-copy { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.ficha-messages-inline .ficha-message-dropzone-copy strong { font-size: .76rem; }
.ficha-messages-inline .ficha-message-dropzone-copy > *:not(strong) { display: none; }
.ficha-messages-inline .ficha-message-dropzone .btn { margin-left: auto; padding: .35rem .6rem; font-size: .74rem; white-space: nowrap; }
.ficha-messages-inline .ficha-message-send { width: 100%; justify-content: center; }
.ficha-messages-inline .ficha-message-bubble { padding: .55rem .65rem; }
.ficha-messages-inline .ficha-message-bubble-head { flex-wrap: wrap; gap: .25rem .4rem; }
.ficha-messages-inline .ficha-message-type { font-size: .62rem; }
.ficha-messages-inline .ficha-message-open-hint { display: none; }
@media (min-width: 1181px) {
  .ficha-grid.ficha-perito-flow { grid-template-columns: minmax(0, 1fr) minmax(360px, 400px); }
}

/* -- Asistente IA (popup): sin scroll exterior; solo se desplaza el hilo de mensajes -- */
.ficha-ai-drawer-body { display: flex; flex-direction: column; overflow: hidden; padding-bottom: .8rem; }
.ficha-ai-drawer-body > * { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ficha-ai-drawer-body .pericial-ai.is-chat-only { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pericial-ai.is-chat-only .pericial-ai__chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pericial-ai.is-chat-only .pericial-ai__messages { flex: 1; height: auto !important; min-height: 120px !important; }
.pericial-ai.is-chat-only .pericial-ai__primary-actions,
.pericial-ai.is-chat-only .pericial-ai__quick-actions,
.pericial-ai.is-chat-only .pericial-ai__composer,
.pericial-ai.is-chat-only .pericial-ai__disclaimer { flex: 0 0 auto; }
.pericial-ai.is-chat-only .pericial-ai__disclaimer { margin: .35rem 0 0; }

/* -- Vista Trabajo: piezas absorbidas de "Informe y detalle" -- */
.ficha-datos-tecnicos { display: grid; gap: .5rem; margin-top: .9rem; }
.ficha-recursos-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .9rem; padding-top: .8rem; border-top: 1px dashed var(--border-color); }
.ficha-recursos-row .eyebrow-mini { margin-right: .2rem; color: var(--neutral-400, #94a3b8); font-size: .64rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.ficha-recursos-row .btn { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .6rem; font-size: .74rem; text-decoration: none; }
.ficha-budget-panel { display: grid; gap: .6rem; }
.ficha-budget-panel > .card, .ficha-budget-panel > section.card { margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; }
.ficha-actividad-plegada { min-width: 0; }
.ficha-activity-list { display: grid; gap: .25rem; }
.ficha-activity-row { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: .6rem; align-items: baseline; padding: .4rem .6rem; border-left: 3px solid var(--ev-color, #64748b); border-radius: 0 8px 8px 0; background: var(--bg-soft, #f8fafc); font-size: .78rem; }
.ficha-activity-row[role="button"] { cursor: pointer; }
.ficha-activity-row[role="button"]:hover { background: #f1f5f9; }
.ficha-activity-when { color: var(--neutral-500, #64748b); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ficha-activity-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficha-activity-row:hover .ficha-activity-what { white-space: normal; }
.ficha-activity-more { margin-top: .4rem; justify-self: start; font-size: .74rem; }
@media (min-width: 1181px) {
  .ficha-grid.ficha-perito-flow #sec-actividad-wrap { order: 5; grid-column: 1; }
  .ficha-grid.ficha-perito-flow .ficha-rail { grid-row: 1 / span 4; }
}
@media (max-width: 1180px) {
  .ficha-grid.ficha-perito-flow #sec-actividad-wrap { order: 5; grid-column: 1; }
}
@media (max-width: 640px) { .ficha-activity-row { grid-template-columns: 1fr; gap: .1rem; } }

/* -- Herramientas del perito (carril lateral) -- */
.ficha-herramientas-list { display: grid; gap: .35rem; }
.ficha-herramienta { display: grid; grid-template-columns: 30px minmax(0, 1fr) 14px; align-items: center; gap: .55rem; padding: .45rem .6rem; border: 1px solid var(--border-color); border-radius: 10px; color: inherit; text-decoration: none; background: var(--bg-card); }
.ficha-herramienta:hover { border-color: #c4b5fd; background: #faf5ff; }
.ficha-herramienta-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--bg-soft, #f1f5f9); color: var(--neutral-600, #475569); }
.ficha-herramienta-copy { display: grid; min-width: 0; }
.ficha-herramienta-copy strong { font-size: .8rem; }
.ficha-herramienta-copy small { color: var(--neutral-500, #64748b); font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficha-herramienta > svg:last-child { color: var(--neutral-400, #94a3b8); }
.ficha-recursos-row { display: none; }

/* -- Datos: líneas de resultado de Catastro y Meteo (la herramienta va en popup) -- */
.ficha-riesgo-strip { display: grid; gap: .4rem; margin-top: .9rem; padding-top: .85rem; border-top: 1px dashed var(--border-color); }
.ficha-riesgo-line { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .45rem .7rem; border-radius: 10px; border: 1px solid var(--border-color); background: var(--bg-soft, #f8fafc); font-size: .8rem; }
.ficha-riesgo-line > svg { flex: 0 0 auto; color: var(--neutral-500, #64748b); }
.ficha-riesgo-line > strong { min-width: 62px; }
.ficha-riesgo-data { flex: 1 1 260px; min-width: 0; color: var(--neutral-600, #475569); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficha-riesgo-data b { color: var(--text-main, #0f172a); font-variant-numeric: tabular-nums; }
.ficha-riesgo-data a { margin-left: .5rem; color: var(--info, #1d4ed8); font-weight: 700; text-decoration: none; }
.ficha-riesgo-btn { margin-left: auto; padding: .25rem .6rem; font-size: .72rem; }
.ficha-riesgo-line.is-ok { border-color: #bbf7d0; background: #f0fdf4; }
.ficha-riesgo-line.is-ok > svg { color: #15803d; }
.ficha-riesgo-line.is-pending { border-color: #fde68a; background: #fffbeb; }
.ficha-riesgo-line.is-pending > svg { color: #b45309; }
.ficha-riesgo-line.is-muted { opacity: .75; }
.ficha-datos-tecnicos { display: none; }
@media (max-width: 640px) { .ficha-riesgo-data { white-space: normal; } .ficha-riesgo-btn { margin-left: 0; } }
.ficha-riesgo-candidatos { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; white-space: normal; }
.ficha-riesgo-candidatos select { flex: 1 1 220px; min-width: 0; padding: .3rem .5rem; font-size: .78rem; }

/* ==========================================================================
   AUTOCITA + CENTRO DE CONTACTO (ficha, ajustes, cuadros de mando)
   ========================================================================== */
.ficha-contacto-card { margin: 0 0 1rem; }
.ficha-contacto-toggle { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; }
.ficha-contacto-aviso { margin: .2rem 0 .8rem; padding: .55rem .8rem; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; color: #92400e; font-size: .8rem; }
.ficha-contacto-aviso.is-info { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
.ficha-contacto-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.ficha-contacto-col { min-width: 0; display: grid; gap: .55rem; align-content: start; }
.ficha-contacto-persona strong { display: block; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficha-contacto-tel { color: var(--neutral-600, #475569); font-size: .82rem; font-variant-numeric: tabular-nums; }
.ficha-contacto-tel.is-missing { color: #b45309; font-weight: 700; }
.ficha-contacto-canales { display: flex; gap: .4rem; flex-wrap: wrap; }
.ficha-contacto-canales .btn { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; text-decoration: none; }
.ficha-btn-wa { border-color: #25d366 !important; color: #fff !important; background: #25d366 !important; }
.ficha-btn-wa:disabled { opacity: .45; }
.ficha-btn-primary-soft { border-color: #c7d2fe !important; background: #eef2ff !important; color: #3730a3 !important; }
.ficha-contacto-crear { display: inline-flex; align-items: center; gap: .35rem; justify-self: start; font-size: .78rem; border-style: dashed !important; }
.ficha-contacto-seguimiento { display: grid; gap: .3rem; padding: .6rem .75rem; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-soft, #f8fafc); font-size: .8rem; }
.ficha-contacto-seguimiento div { display: flex; justify-content: space-between; gap: .6rem; }
.ficha-contacto-seguimiento span { color: var(--neutral-500, #64748b); }
.ficha-contacto-seguimiento b { text-align: right; font-variant-numeric: tabular-nums; }
.ficha-contacto-seguimiento.is-vencido { border-color: #fecaca; background: #fef2f2; }
.ficha-contacto-acciones { display: flex; gap: .4rem; flex-wrap: wrap; }
.ficha-contacto-acciones .btn { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; text-decoration: none; }
.ficha-cita-box { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem; border: 1px solid #bbf7d0; border-radius: 12px; background: #f0fdf4; color: #14532d; }
.ficha-cita-box > svg { flex: 0 0 auto; color: #15803d; margin-top: 2px; }
.ficha-cita-box strong { display: block; font-size: .9rem; }
.ficha-cita-box small { color: #166534; font-size: .74rem; }
.ficha-autocita-box { display: grid; gap: .25rem; padding: .6rem .75rem; border: 1px solid #ddd6fe; border-radius: 10px; background: #faf5ff; font-size: .8rem; }
.ficha-autocita-box div { display: flex; justify-content: space-between; gap: .6rem; }
.ficha-autocita-box span { color: #6b7280; }
.ficha-contacto-vacio { margin: 0; color: var(--neutral-600, #475569); font-size: .8rem; line-height: 1.45; }
.ficha-contacto-historial { margin-top: .9rem; padding-top: .8rem; border-top: 1px dashed var(--border-color); display: grid; gap: .25rem; }
.ficha-contacto-hist-row { display: grid; grid-template-columns: 130px 90px minmax(0, 1fr); gap: .6rem; font-size: .76rem; padding: .3rem .5rem; border-radius: 8px; background: var(--bg-soft, #f8fafc); }
.ficha-contacto-hist-row span { color: var(--neutral-500, #64748b); font-variant-numeric: tabular-nums; }
.ficha-contacto-hist-row em { font-style: normal; color: var(--neutral-600, #475569); }
.ficha-tipo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.ficha-tipo-grid.is-compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ficha-tipo-btn { display: grid; gap: .15rem; padding: .8rem .9rem; border: 2px solid var(--border-color); border-radius: 12px; background: var(--bg-card); text-align: left; font: inherit; cursor: pointer; }
.ficha-tipo-btn strong { font-size: .88rem; }
.ficha-tipo-btn small { color: var(--neutral-500, #64748b); font-size: .72rem; }
.ficha-tipo-btn.is-default { border-color: #c4b5fd; }
.ficha-tipo-btn.is-selected, .ficha-tipo-btn:hover { border-color: #6d28d9; background: #faf5ff; }
.ficha-retry-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .8rem; }
.ficha-sms-qr { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1rem; align-items: start; }
.ficha-sms-qr img { width: 220px; height: 220px; border: 1px solid var(--border-color); border-radius: 12px; }
.ficha-sms-qr p { margin: 0 0 .6rem; font-size: .84rem; line-height: 1.45; }
.ficha-sms-dest { font-size: .82rem; margin-bottom: .4rem; }
.ficha-sms-preview { white-space: pre-wrap; font: inherit; font-size: .78rem; padding: .6rem .7rem; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-soft, #f8fafc); margin: 0 0 .7rem; }
.ficha-hueco-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: .8rem; }
.ficha-hueco-dias { display: grid; gap: .3rem; align-content: start; max-height: 320px; overflow: auto; }
.ficha-hueco-dias .btn { justify-content: space-between; font-size: .78rem; }
.ficha-hueco-horas { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .4rem; align-content: start; }
.ficha-hueco-horas .btn { justify-content: center; font-variant-numeric: tabular-nums; }
@media (max-width: 1120px) { .ficha-contacto-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .ficha-sms-qr, .ficha-hueco-grid { grid-template-columns: 1fr; } .ficha-sms-qr img { margin: 0 auto; } .ficha-contacto-hist-row { grid-template-columns: 1fr; } }

/* -- Ajustes: disponibilidad -- */
.disp-miembro { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 700; }
.disp-miembro select { min-width: 200px; }
.disp-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.2rem; }
.disp-block:first-child { grid-row: span 2; }
.disp-semana { display: grid; gap: .4rem; }
.disp-dia { padding: .5rem .7rem; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-soft, #f8fafc); display: grid; gap: .35rem; }
.disp-dia.is-on { background: var(--bg-card); border-color: #99f6e4; }
.disp-dia-head { display: flex; align-items: center; gap: .5rem; font-size: .84rem; cursor: pointer; }
.disp-franja { display: flex; align-items: center; gap: .4rem; }
.disp-franja input[type="time"] { width: 112px; padding: .3rem .5rem; }
.disp-icon-btn { padding: .3rem .45rem; }
.disp-add { justify-self: start; font-size: .74rem; padding: .25rem .55rem; }
.disp-tipos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.disp-tipo { display: grid; gap: .35rem; padding: .6rem .7rem; border: 1px solid var(--border-color); border-radius: 10px; }
.disp-tipo label, .disp-reglas label { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--neutral-600, #475569); }
.disp-tipo input, .disp-reglas input { width: 72px; padding: .3rem .45rem; }
.disp-reglas { display: grid; gap: .4rem; }
.disp-reglas select { width: auto; padding: .3rem .5rem; }
.disp-previa { margin-top: .7rem; padding: .6rem .75rem; border: 1px dashed #99f6e4; border-radius: 10px; background: #f0fdfa; font-size: .78rem; display: grid; gap: .25rem; }
.disp-exc-form { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.disp-exc-form input[type="date"], .disp-exc-form input[type="time"] { width: auto; padding: .3rem .5rem; }
.disp-exc-form input[type="text"] { flex: 1 1 160px; padding: .3rem .5rem; }
.disp-exc-form select { width: auto; padding: .3rem .5rem; }
.disp-check { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; }
.disp-exc-list { display: grid; gap: .3rem; margin-top: .6rem; }
.disp-exc { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: .5rem; padding: .4rem .6rem; border-radius: 8px; border: 1px solid #fecaca; background: #fef2f2; font-size: .78rem; }
.disp-exc.is-extra { border-color: #bbf7d0; background: #f0fdf4; }
@media (max-width: 1000px) { .disp-grid { grid-template-columns: 1fr; } .disp-block:first-child { grid-row: auto; } .disp-tipos { grid-template-columns: 1fr; } }

/* -- Dashboard: contactos -- */
.contactos-panel { margin-top: 1rem; }
.contactos-panel-resumen { font-size: .76rem; color: var(--neutral-500, #64748b); }
.contactos-panel-resumen b { color: var(--text-main, #0f172a); }
.contactos-panel-resumen b.is-bad { color: #b91c1c; }
.contactos-panel-list { display: grid; gap: .35rem; }
.contactos-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto 150px 16px; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); font: inherit; font-size: .8rem; text-align: left; cursor: pointer; }
.contactos-row:hover { border-color: #c4b5fd; }
.contactos-row.is-vencido { border-color: #fecaca; background: #fff7f7; }
.contactos-row-ref { font-weight: 800; font-variant-numeric: tabular-nums; }
.contactos-row-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contactos-row-when { color: var(--neutral-500, #64748b); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 760px) { .contactos-row { grid-template-columns: 1fr auto; } .contactos-row-when, .contactos-row > svg { display: none; } }

/* -- Agenda: todo a la vista sin scroll (cabecera compacta + hoy en dos columnas) -- */
.agenda-top-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.agenda-head-top { padding: .75rem 1.15rem .55rem; align-items: center; }
.agenda-hero .page-title { font-size: 1.3rem; margin: 0; }
.agenda-hero .page-title + p, .agenda-title-block > p { display: none; }
.agenda-toolbar { padding-top: 0 !important; }
.page-shell:has(.agenda-hero) { gap: .8rem !important; }
@media (max-width: 1120px) { .agenda-top-grid { grid-template-columns: 1fr; } }

.ficha-contacto-resumen { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; font-size: .82rem; }
.ficha-cierre-card { margin: 0; }
@media (min-width: 1181px) {
  .ficha-grid.ficha-perito-flow #sec-cierre { order: 4; grid-column: 1; }
  .ficha-grid.ficha-perito-flow #sec-actividad-wrap { order: 6; }
  .ficha-grid.ficha-perito-flow .ficha-rail { grid-row: 1 / span 5; }
}
@media (max-width: 1180px) { .ficha-grid.ficha-perito-flow #sec-cierre { order: 4; grid-column: 1; } .ficha-grid.ficha-perito-flow #sec-actividad-wrap { order: 6; } }
/* Dashboard perito: franja única de indicadores */
.perito-hero.perito-hero-slim { display: block; padding: .8rem; }
.perito-kpis.perito-kpis-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .6rem; }
.perito-kpi.is-green .perito-kpi-icon { color: #15803d; background: #dcfce7; }
.perito-side-stack .contactos-panel { margin-top: 0; }
@media (max-width: 1400px) { .perito-kpis.perito-kpis-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .perito-kpis.perito-kpis-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* -- Ronda UX: SMS sin scroll lateral, comunicaciones legibles, toggles de icono -- */
.ficha-sms-qr { grid-template-columns: 200px minmax(0, 1fr); }
.ficha-sms-qr > * { min-width: 0; }
.ficha-sms-preview { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.ficha-contacto-toggle.is-icon { padding: .3rem .45rem; }
.ficha-messages-inline .ficha-message-timeline { gap: .7rem !important; max-height: 440px !important; }
.ficha-messages-inline .ficha-message-event { width: 100%; }
.ficha-messages-inline .ficha-message-rail { display: none; }
.ficha-messages-inline .ficha-message-bubble { padding: .75rem .9rem; border-radius: 12px; width: 100%; box-sizing: border-box; }
.ficha-messages-inline .ficha-message-bubble-head { margin-bottom: .35rem; }
.ficha-messages-inline .ficha-message-author strong { font-size: .84rem; }
.ficha-messages-inline .ficha-message-text { font-size: .88rem; line-height: 1.5; }
.ficha-messages-inline .ficha-message-day { margin: .2rem 0; }
.ficha-messages-inline .ficha-message-day span { font-size: .7rem; padding: .2rem .7rem; }
.ficha-messages-inline .ficha-message-read-receipt { font-size: .7rem; margin-top: .35rem; }
.ficha-messages-inline .ficha-message-attachment { margin-top: .35rem; }
@media (max-width: 640px) { .ficha-sms-qr { grid-template-columns: 1fr; } }

/* Conversación en el carril: la burbuja ocupa todo el ancho (sin columna del raíl). */
.ficha-messages-inline .ficha-message-event { display: block; }
.ficha-messages-inline .ficha-message-bubble { max-width: 100%; }
.ficha-messages-inline .ficha-message-bubble-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ficha-messages-inline .ficha-message-bubble-head time { margin-left: auto; }
.ficha-messages-inline .ficha-message-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Vista Trabajo: las cabeceras plegables (Evidencias, Actividad) se ven también en escritorio,
   con su número y su nombre, y se pliegan al pulsar. */
.ficha-perito-flow .ficha-evidence-section .mobile-collapsible-toggle,
.ficha-perito-flow .ficha-actividad-plegada .mobile-collapsible-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem; width: 100%;
  padding: .7rem .95rem; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-card);
  font: inherit; text-align: left; cursor: pointer;
}
.ficha-perito-flow .ficha-evidence-section .mobile-collapsible-body,
.ficha-perito-flow .ficha-actividad-plegada .mobile-collapsible-body { display: none; }
.ficha-perito-flow .ficha-evidence-section .mobile-collapsible-body.is-open,
.ficha-perito-flow .ficha-actividad-plegada .mobile-collapsible-body.is-open { display: block; }
.ficha-perito-flow .ficha-section-heading { display: inline-flex; align-items: center; gap: .55rem; }
.ficha-perito-flow .ficha-section-heading strong { font-size: .98rem; font-weight: 800; color: var(--text-main); }
.ficha-perito-flow .ficha-section-heading small { display: block; color: var(--neutral-500); font-size: .74rem; font-weight: 500; }

/* Selector de estado con los colores de cada estado */
.cockpit-status-picker { position: relative; min-width: 0; }
.cockpit-status-trigger { display: flex; align-items: center; gap: .4rem; width: 100%; min-height: 36px; padding: .35rem .7rem; border: 1px solid; border-radius: 10px; font: inherit; font-size: .78rem; font-weight: 800; cursor: pointer; text-align: left; }
.cockpit-status-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: 100%; margin: 0; padding: .35rem; list-style: none; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); box-shadow: 0 14px 38px rgba(15,23,42,.18); display: grid; gap: .15rem; max-height: 340px; overflow: auto; }
.cockpit-status-option { display: flex; align-items: center; justify-content: space-between; gap: .6rem; width: 100%; padding: .3rem .4rem; border: 0; border-radius: 8px; background: transparent; font: inherit; cursor: pointer; text-align: left; }
.cockpit-status-option:hover, .cockpit-status-option.is-active { background: var(--bg-soft, #f8fafc); }
.cockpit-status-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .6rem; border: 1px solid; border-radius: 999px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.cockpit-status-chip i, .cockpit-status-trigger i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; }

/* -- Detalle de comunicación: pasar a la anterior/siguiente sin cerrar -- */
.message-detail-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: -.25rem 0 0; }
.message-detail-nav span { font-size: .74rem; color: var(--text-muted); font-weight: 700; white-space: nowrap; }
.message-detail-nav .btn { display: inline-flex; align-items: center; gap: .25rem; padding: .35rem .6rem; font-size: .76rem; }
.message-detail-nav .btn:disabled { opacity: .4; cursor: default; }

/* ========================================================================
   FICHA DE CAMPO MÓVIL
   La ficha conserva una única fuente de datos, pero en pantalla estrecha
   prioriza próxima tarea, contacto, peritación, evidencias e IA.
   ======================================================================== */
.ficha-mobile-field-nav,
.ficha-mobile-more,
.ficha-mobile-more-backdrop { display: none; }

@media (max-width: 760px) {
  .ficha-page-shell.is-field-view {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  .ficha-page-shell.is-field-view .ficha-subnav,
  .ficha-page-shell.is-field-view .ficha-ai-fab { display: none !important; }

  .ficha-page-shell.is-field-view .ficha-case-hero {
    gap: .45rem !important;
    padding: .7rem .72rem !important;
    border-radius: 15px;
  }
  .ficha-page-shell.is-field-view .ficha-view-toggle-top { display: none; }
  .ficha-page-shell.is-field-view .ficha-case-main { gap: .35rem !important; }
  .ficha-page-shell.is-field-view .ficha-title-meta {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .3rem .45rem !important;
    align-items: center !important;
  }
  .ficha-page-shell.is-field-view .ficha-case-reference {
    grid-column: 1;
    font-size: 1.05rem !important;
    white-space: nowrap;
  }
  .ficha-page-shell.is-field-view .ficha-case-insured {
    grid-column: 1 / -1;
    display: -webkit-box;
    overflow: hidden;
    font-size: .9rem !important;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .ficha-page-shell.is-field-view .ficha-case-actions { display: none !important; }

  .ficha-page-shell.is-field-view .ficha-role-cockpit.is-ahora {
    margin-top: .55rem;
    padding: .72rem;
    gap: .6rem;
    border-radius: 16px;
  }
  .ficha-page-shell.is-field-view .ficha-role-cockpit.is-ahora .cockpit-work-area { order: 1; }
  .ficha-page-shell.is-field-view .ficha-role-cockpit.is-ahora .cockpit-action-area { order: 2; gap: .55rem; }
  .ficha-page-shell.is-field-view .ficha-role-cockpit.is-ahora .perito-workflow { padding: 0; }
  .ficha-page-shell.is-field-view .ficha-role-cockpit.is-ahora .perito-workflow-foot { display: none; }

  /* Acciones de visita: tablero de campo. La acción dominante abre la peritación y
     las cuatro tarjetas inferiores quedan al alcance del pulgar. */
  .ficha-page-shell.is-field-view .ficha-mobile-visit-hub {
    display: grid;
    gap: .55rem;
    margin-top: .55rem;
    padding: .72rem;
    border: 1px solid #bfdbfe;
    border-radius: 18px;
    background: linear-gradient(145deg, #f8fbff, #fff 56%, #f5f3ff);
    box-shadow: 0 9px 25px rgba(37, 99, 235, .08);
  }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-head { display:flex; align-items:center; justify-content:space-between; gap:.5rem; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-head > span { display:inline-flex; align-items:center; gap:.35rem; color:#1d4ed8; font-size:.66rem; font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-head small { color:#64748b; font-size:.66rem; font-weight:700; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-primary {
    display:flex;
    width:100%;
    min-height:78px;
    align-items:center;
    gap:.7rem;
    padding:.72rem .76rem;
    border:1px solid #7c3aed;
    border-radius:16px;
    background:linear-gradient(135deg,#5b21b6,#7c3aed 62%,#9333ea);
    color:#fff;
    box-shadow:0 10px 22px rgba(109,40,217,.24);
    font:inherit;
    text-align:left;
    cursor:pointer;
  }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-primary-icon { display:grid; flex:0 0 auto; width:46px; height:46px; place-items:center; border-radius:14px; background:rgba(255,255,255,.16); }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-primary > span:nth-child(2) { display:grid; min-width:0; gap:.12rem; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-primary strong { font-size:1rem; line-height:1.15; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-primary small { font-size:.7rem; opacity:.82; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-primary-arrow { margin-left:auto; flex:0 0 auto; transform:rotate(-90deg); }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.5rem; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > a,
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > button,
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > span {
    display: flex;
    min-width: 0;
    min-height: 68px;
    align-items: center;
    gap: .55rem;
    padding: .58rem .68rem;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: var(--bg-card, #fff);
    color: var(--text-main, #0f172a);
    box-shadow: 0 5px 14px rgba(15, 23, 42, .05);
    font: inherit;
    text-align: left;
    text-decoration: none;
  }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > .is-photos { border-color:#bbf7d0; background:linear-gradient(135deg,#f0fdf4,#fff); color:#047857; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > .is-route {
    border-color: #bfdbfe;
    background: linear-gradient(135deg, #eff6ff, #fff);
    color: #1d4ed8;
  }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > .is-call { border-color:#a7f3d0; background:linear-gradient(135deg,#ecfdf5,#fff); color:#047857; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > .is-note {
    border-color: #fed7aa;
    background: linear-gradient(135deg, #fff7ed, #fff);
    color: #c2410c;
  }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > .is-disabled { opacity: .58; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > button:disabled { cursor: wait; opacity: .68; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid svg { flex: 0 0 auto; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > * > span { display: grid; min-width: 0; gap: .08rem; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid strong { font-size: .76rem; line-height: 1.15; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-grid small {
    overflow: hidden;
    color: currentColor;
    font-size: .64rem;
    line-height: 1.2;
    opacity: .72;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-status { display:flex; align-items:flex-start; gap:.42rem; padding:.5rem .58rem; border:1px solid #fed7aa; border-radius:11px; background:#fff7ed; color:#9a3412; font-size:.68rem; font-weight:700; line-height:1.35; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-status.is-ready { border-color:#bbf7d0; background:#f0fdf4; color:#15803d; }
  .ficha-page-shell.is-field-view .ficha-mobile-visit-status svg { flex:0 0 auto; margin-top:.02rem; }

  /* La peritación abierta desde Acciones de visita ocupa la pantalla útil. El panel
     conserva un único desplazamiento interno y deja siempre accesible cerrar. */
  .mobile-visit-workspace-modal .app-modal-body { padding: .65rem !important; }

  @media (max-width: 370px) {
    .ficha-page-shell.is-field-view .ficha-mobile-visit-grid { gap: .4rem; }
    .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > a,
    .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > button,
    .ficha-page-shell.is-field-view .ficha-mobile-visit-grid > span {
      gap: .4rem;
      padding: .5rem;
    }
    .ficha-page-shell.is-field-view .ficha-mobile-visit-grid strong { font-size: .72rem; }
    .ficha-page-shell.is-field-view .ficha-mobile-visit-grid small { font-size: .6rem; }
  }

  /* Catastro y meteorología siguen en los datos del expediente, pero no
     compiten con las herramientas de una visita presencial en el móvil. */
  .ficha-page-shell.is-field-view .ficha-riesgo-strip { display: none !important; }

  /* Informe y cierre se muestran como resúmenes de una sola línea. Se abren
     cuando el perito los necesita o desde el menú inferior. */
  .ficha-page-shell.is-field-view .is-mobile-field-collapsible {
    padding: .68rem !important;
    border-radius: 15px;
  }
  .ficha-page-shell.is-field-view .is-mobile-field-collapsible > .ficha-info-header {
    flex-wrap: nowrap;
    gap: .45rem;
  }
  .ficha-page-shell.is-field-view .is-mobile-field-collapsible.is-open > .ficha-info-header { flex-wrap: wrap; }
  .ficha-page-shell.is-field-view .is-mobile-field-collapsible.is-open > .ficha-info-header .ficha-evidence-tabs-slim {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }
  .ficha-page-shell.is-field-view .is-mobile-field-collapsible > .ficha-info-header .ficha-mobile-section-toggle { margin-left: auto; }
  .ficha-page-shell.is-field-view .is-mobile-field-collapsible:not(.is-open) > .ficha-info-header .ficha-evidence-tabs-slim { display: none; }
  .ficha-page-shell.is-field-view .ficha-mobile-section-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    min-height: 36px;
    align-items: center;
    gap: .25rem;
    padding: .38rem .55rem;
    border: 1px solid #ddd6fe;
    border-radius: 10px;
    background: #f5f3ff;
    color: #6d28d9;
    font: inherit;
    font-size: .7rem;
    font-weight: 800;
  }
  .ficha-page-shell.is-field-view .is-mobile-field-collapsible.is-open .ficha-mobile-section-toggle svg { transform: rotate(180deg); }
  .ficha-page-shell.is-field-view .ficha-mobile-section-body { padding-top: .55rem; }
  .ficha-page-shell.is-field-view .ficha-mobile-collapse-heading {
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .55rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-main, #0f172a);
    font: inherit;
    text-align: left;
  }
  .ficha-page-shell.is-field-view .ficha-mobile-collapse-heading > span:nth-child(2) { display: grid; gap: .08rem; }
  .ficha-page-shell.is-field-view .ficha-mobile-collapse-heading strong { font-size: .86rem; }
  .ficha-page-shell.is-field-view .ficha-mobile-collapse-heading small { color: var(--text-muted, #64748b); font-size: .66rem; font-weight: 550; }
  .ficha-page-shell.is-field-view .ficha-mobile-collapse-heading > svg { color: #64748b; transition: transform .2s ease; }
  .ficha-page-shell.is-field-view .ficha-cierre-card.is-open .ficha-mobile-collapse-heading > svg { transform: rotate(180deg); }

  .ficha-page-shell.is-field-view > .card,
  .ficha-page-shell.is-field-view .ficha-grid > div > .card { scroll-margin-top: 72px; }

  .ficha-mobile-field-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1080;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: 64px;
    padding: .35rem .32rem calc(.35rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #dbe3ef;
    background: color-mix(in srgb, var(--bg-card, #fff) 94%, transparent);
    box-shadow: 0 -10px 28px rgba(15, 23, 42, .12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .ficha-mobile-field-nav > button {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 50px;
    place-content: center;
    justify-items: center;
    gap: .12rem;
    padding: .25rem .08rem;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #64748b;
    font: inherit;
    cursor: pointer;
  }
  .ficha-mobile-field-nav > button span { font-size: .61rem; font-weight: 750; white-space: nowrap; }
  .ficha-mobile-field-nav > button.active { color: #5b21b6; background: #f3e8ff; }
  .ficha-mobile-field-nav > button.is-ai { color: #7c3aed; }
  .ficha-mobile-field-nav > button.is-ai.active { color: #fff; background: linear-gradient(135deg, #7c3aed, #db2777); }
  .ficha-mobile-field-nav > button b {
    position: absolute;
    top: 2px;
    right: calc(50% - 20px);
    display: grid;
    min-width: 16px;
    height: 16px;
    place-items: center;
    padding: 0 3px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: .56rem;
  }

  .ficha-mobile-more-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1085;
    display: block;
    border: 0;
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(2px);
  }
  .ficha-mobile-more {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1090;
    display: block;
    padding: .8rem .85rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
    background: var(--bg-card, #fff);
    box-shadow: 0 -20px 55px rgba(15, 23, 42, .24);
  }
  .ficha-mobile-more > header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .7rem; }
  .ficha-mobile-more > header > div { display: grid; gap: .05rem; }
  .ficha-mobile-more > header small { color: #7c3aed; font-size: .58rem; font-weight: 850; letter-spacing: .1em; }
  .ficha-mobile-more > header strong { color: var(--text-main, #0f172a); font-size: 1rem; }
  .ficha-mobile-more > header button { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--border-color); border-radius: 11px; background: var(--bg-soft, #f8fafc); color: var(--text-main); }
  .ficha-mobile-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .ficha-mobile-more-grid > button {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 56px;
    align-items: center;
    gap: .55rem;
    padding: .65rem .72rem;
    border: 1px solid var(--border-color);
    border-radius: 13px;
    background: var(--bg-soft, #f8fafc);
    color: var(--text-main, #0f172a);
    font: inherit;
    font-size: .76rem;
    font-weight: 750;
    text-align: left;
  }
  .ficha-mobile-more-grid > button svg { flex: 0 0 auto; color: #6d28d9; }
  .ficha-mobile-more-grid > button b { margin-left: auto; padding: .1rem .4rem; border-radius: 999px; background: #dc2626; color: #fff; font-size: .62rem; }
  .ficha-mobile-more-grid > button.is-management { grid-column: 1 / -1; justify-content: center; border-color: #c4b5fd; background: #f5f3ff; color: #5b21b6; }
}

/* Dashboard móvil: las métricas principales mantienen una lectura de dos
   columnas y la quinta completa la fila, evitando una tarjeta aislada. */
@media (max-width: 640px) {
  .manager-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: .6rem; }
  .manager-kpi { min-width: 0; min-height: 104px; padding: .62rem; gap: .45rem; }
  .manager-kpi:nth-child(5) { grid-column: 1 / -1; min-height: 76px; }
  .manager-kpi-icon { width: 34px; height: 34px; }
  .manager-kpi-copy { column-gap: .35rem; }
  .manager-kpi-copy small { font-size: .64rem; }
  .manager-kpi-copy strong { font-size: 1.65rem; }
  .manager-kpi-copy em { font-size: .64rem; }
}

/* Un borrador no tiene aún el bloque de datos de un encargo real. En móvil su
   identificación debe ser una cabecera breve: la referencia puede ser un UUID
   largo, pero nunca debe estirar la tarjeta ni dejar el vencimiento al fondo. */
@media (max-width: 760px) {
  .ficha-page-shell.is-draft-expediente .ficha-case-hero,
  .ficha-page-shell.is-draft-expediente .ficha-case-main,
  .ficha-page-shell.is-draft-expediente .ficha-title-meta {
    min-height: 0 !important;
    height: auto !important;
    align-content: start !important;
  }

  .ficha-page-shell.is-draft-expediente .ficha-title-meta {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: .32rem !important;
  }

  .ficha-page-shell.is-draft-expediente .ficha-case-reference {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal !important;
    font-size: .98rem !important;
    line-height: 1.18 !important;
    letter-spacing: -.02em;
  }

  .ficha-page-shell.is-draft-expediente .ficha-case-insured {
    grid-column: auto !important;
    font-size: .9rem !important;
  }

  .ficha-page-shell.is-draft-expediente .ficha-title-meta > button {
    justify-self: start;
    margin-top: .05rem;
  }
}

/* El menú lateral móvil es un panel flotante: no puede reservar ancho dentro
   del layout. El área de trabajo usa siempre todo el viewport y conserva sólo
   el margen de seguridad lateral de la propia página. */
@media (max-width: 760px) {
  .app-shell.peritix-next > .app-main {
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
  }

  .app-shell.peritix-next > .app-main > .app-content,
  .app-shell.peritix-next > .app-main > .app-content > .dashboard-page {
    width: 100% !important;
    max-width: none !important;
    margin-inline: 0 !important;
    align-self: stretch;
  }
}

/* Selector de contacto de campo: evita iniciar una llamada por accidente y
   permite elegir el canal adecuado con controles grandes para móvil. */
.mobile-contact-choice { display: grid; gap: .7rem; }
.mobile-contact-choice > p { color: var(--text-main, #0f172a); font-size: .88rem; line-height: 1.42; }
.mobile-contact-choice > small { margin-top: -.45rem; color: var(--neutral-500, #64748b); font-size: .78rem; }
.mobile-contact-choice-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.mobile-contact-choice-actions > a { display: grid; min-width: 0; min-height: 116px; align-content: center; justify-items: center; gap: .45rem; padding: .8rem .55rem; border: 1px solid var(--border-color); border-radius: 16px; color: var(--text-main, #0f172a); text-align: center; text-decoration: none; }
.mobile-contact-choice-actions > a > span { display: grid; gap: .12rem; }
.mobile-contact-choice-actions strong { font-size: .9rem; }
.mobile-contact-choice-actions small { color: currentColor; font-size: .67rem; line-height: 1.2; opacity: .74; }
.mobile-contact-choice-actions .is-phone { border-color: #93c5fd; background: linear-gradient(145deg, #eff6ff, #fff); color: #1d4ed8; }
.mobile-contact-choice-actions .is-whatsapp { border-color: #86efac; background: linear-gradient(145deg, #f0fdf4, #fff); color: #15803d; }
.mobile-contact-choice-cancel { width: 100%; justify-content: center; }

@media (max-width: 370px) {
  .mobile-contact-choice-actions { gap: .45rem; }
  .mobile-contact-choice-actions > a { min-height: 102px; padding-inline: .35rem; }
}

/* El shell cambia a navegación móvil hasta 1024 px. El Dashboard debe usar el
   mismo umbral: si se limita a 760 px, algunos iPhone/Safari con escala de
   página aplican la cabecera móvil pero dejan las acciones con ancho de
   contenido. La matriz ocupa siempre toda la anchura útil. */
@media (max-width: 1024px) {
  .app-content > .dashboard-page,
  .app-content > .dashboard-page > .page-head,
  .app-content > .dashboard-page .dashboard-actions {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin-inline: 0 !important;
  }

  .app-content > .dashboard-page > .page-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
  }

  .app-content > .manager-dashboard-page .dashboard-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .45rem !important;
  }

  .app-content > .manager-dashboard-page .dashboard-actions .btn,
  .app-content > .manager-dashboard-page .dashboard-actions .btn:first-child,
  .app-content > .manager-dashboard-page .dashboard-actions .btn.btn-primary {
    grid-column: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 58px;
    justify-content: center !important;
    white-space: normal !important;
  }
}
/* Peritix Next UI - RySwift-inspired design system for the authenticated workspace.
   Language: one accent color (customizable), navy for spotlight KPIs, big radii,
   almost-flat cards, pill navigation, bold numerals with deltas, gentle motion.
   Accent color hook: set --px-accent on .peritix-next (future Ajustes picker). */

/* ============ 1. Design tokens ============ */
.peritix-next{
  --px-accent:#5b21f5;            /* brand accent (RySwift purple, customizable) */
  --px-accent-deep:#4a16d6;
  --px-accent-soft:color-mix(in srgb,var(--px-accent) 9%,#fff);
  --px-accent-softer:color-mix(in srgb,var(--px-accent) 5%,#fff);
  --px-navy:#1a2130;              /* spotlight surfaces (hero, main KPI) */
  --px-navy-soft:#232b3d;
  --px-canvas:#f4f5f8;
  --px-surface:#ffffff;
  --px-surface-soft:#f7f8fb;
  --px-line:#e9ebf2;
  --px-line-soft:#f0f1f7;
  --px-ink:#171a2b;
  --px-muted:#737a90;
  --px-faint:#a4a9bc;
  --px-green:#16a34a;
  --px-green-soft:#e9f9ef;
  --px-red:#dc2626;
  --px-red-soft:#fdeeee;
  --px-amber:#d97706;
  --px-amber-soft:#fdf3e2;
  --px-radius:20px;
  --px-radius-sm:13px;
  --px-shadow:0 1px 2px rgba(23,26,43,.04),0 6px 18px rgba(23,26,43,.045);
  --px-shadow-hover:0 3px 6px rgba(23,26,43,.05),0 16px 34px rgba(23,26,43,.09);
  --px-ease:.16s cubic-bezier(.33,1,.38,1);

  /* Re-map global tokens so every shared component inherits the language */
  --primary:var(--px-accent);
  --primary-strong:var(--px-accent-deep);
  --primary-soft:var(--px-accent-soft);
  --bg-main:var(--px-canvas);
  --bg-card:var(--px-surface);
  --bg-soft:var(--px-surface-soft);
  --bg-accent:var(--px-accent-soft);
  --text-main:var(--px-ink);
  --text-muted:var(--px-muted);
  --border-color:var(--px-line);
  --border-soft:var(--px-line-soft);
  --radius-xl:22px;
  --radius-lg:18px;
  --radius-md:13px;
  --radius-sm:10px;
  --shadow-xs:0 1px 2px rgba(23,26,43,.04);
  --shadow-sm:var(--px-shadow);
  --shadow-md:var(--px-shadow-hover);

  background:radial-gradient(circle at 82% -12%,color-mix(in srgb,var(--px-accent) 6%,transparent),transparent 30rem),var(--px-canvas);
  color:var(--px-ink);
}

/* ============ 2. Typography and page structure ============ */
.peritix-next .app-main{background:transparent}
.peritix-next .app-content{width:100%;max-width:1560px;padding:1.6rem clamp(1rem,2.2vw,2.25rem) 2.75rem;scrollbar-gutter:stable}
.peritix-next .page-shell{gap:1.05rem}
.peritix-next .page-title,.peritix-next h1,.peritix-next h2,.peritix-next h3{color:var(--px-ink);letter-spacing:-.03em}
.peritix-next .page-title{font-size:clamp(1.5rem,2vw,2.05rem);font-weight:800}
.peritix-next .page-subtitle,.peritix-next .helper-text{color:var(--px-muted)}
.peritix-next .section-title{letter-spacing:-.02em}
.peritix-next ::selection{background:color-mix(in srgb,var(--px-accent) 22%,#fff)}
.peritix-next ::-webkit-scrollbar{width:10px;height:10px}
.peritix-next ::-webkit-scrollbar-thumb{border:3px solid transparent;border-radius:99px;background:#d4d7e2;background-clip:content-box}
.peritix-next ::-webkit-scrollbar-thumb:hover{background:#b9bdcd;background-clip:content-box}

/* ============ 3. Buttons ============ */
.peritix-next .btn{min-height:40px;padding-inline:.95rem;border-color:var(--px-line);border-radius:12px;color:#3f4459;background:var(--px-surface);font-weight:700;box-shadow:0 1px 2px rgba(23,26,43,.04);transition:transform var(--px-ease),box-shadow var(--px-ease),border-color var(--px-ease),color var(--px-ease),background var(--px-ease)}
.peritix-next .btn:hover{border-color:color-mix(in srgb,var(--px-accent) 34%,var(--px-line));color:var(--px-accent-deep);background:#fff;box-shadow:var(--px-shadow);transform:translateY(-1px)}
.peritix-next .btn:active{transform:translateY(0)}
.peritix-next .btn-primary{border-color:transparent;color:#fff;background:var(--px-accent);box-shadow:0 8px 18px color-mix(in srgb,var(--px-accent) 26%,transparent)}
.peritix-next .btn-primary:hover{border-color:transparent;color:#fff;background:var(--px-accent-deep);box-shadow:0 11px 24px color-mix(in srgb,var(--px-accent) 32%,transparent)}
.peritix-next .btn-soft{border-color:transparent;color:var(--px-accent-deep);background:var(--px-accent-soft)}
.peritix-next .btn-soft:hover{border-color:transparent;color:var(--px-accent-deep);background:color-mix(in srgb,var(--px-accent) 14%,#fff)}

/* ============ 4. Cards and surfaces ============ */
.peritix-next .card,.peritix-next .dashboard-panel,.peritix-next .dashboard-metric,.peritix-next .table-card,.peritix-next .settings-section,.peritix-next .config-card,.peritix-next .kpi-card{border-color:var(--px-line);border-radius:var(--px-radius);background:var(--px-surface);box-shadow:var(--px-shadow)}
.peritix-next .card,.peritix-next .dashboard-panel,.peritix-next .dashboard-metric,.peritix-next .kpi-card{transition:border-color var(--px-ease),box-shadow var(--px-ease),transform var(--px-ease)}
.peritix-next .card:hover,.peritix-next .dashboard-panel:hover,.peritix-next .dashboard-metric:hover,.peritix-next .kpi-card:hover{border-color:color-mix(in srgb,var(--px-accent) 18%,var(--px-line));box-shadow:var(--px-shadow-hover)}
.peritix-next .card-head{border-color:var(--px-line-soft)}

/* ============ 5. Sidebar ============ */
.peritix-next .sidebar.sidebar-invo{width:250px;border-right-color:var(--px-line);background:var(--px-surface)}
.peritix-next .sidebar.sidebar-invo.is-collapsed{width:78px}
.peritix-next .sidebar-invo-top{height:66px;border-bottom-color:transparent;padding-inline:1.05rem}
.peritix-next .sidebar-invo-logo,.peritix-next .sidebar-account-avatar,.peritix-next .header-invo-avatar{border-radius:12px;background:var(--px-accent);box-shadow:0 7px 16px color-mix(in srgb,var(--px-accent) 28%,transparent)}
.peritix-next .sidebar-invo-title{color:var(--px-ink);font-size:1.04rem;font-weight:800;letter-spacing:-.02em}
.peritix-next .sidebar-workspace-block>*{border-color:var(--px-line)!important;border-radius:14px!important;background:var(--px-surface-soft)!important}
.peritix-next .sidebar-invo-nav{padding:.8rem .7rem;gap:.16rem}
.peritix-next .sidebar-section-label{margin-top:.75rem;padding-inline:.55rem;color:var(--px-faint);font-size:.6rem;font-weight:800;letter-spacing:.13em;text-transform:uppercase}
.peritix-next .sidebar-invo-link{min-height:42px;padding:.58rem .75rem;border-radius:12px;color:#6e7488;font-size:.8rem;font-weight:600;transition:background var(--px-ease),color var(--px-ease)}
.peritix-next .sidebar-invo-link:hover{color:var(--px-ink);background:var(--px-surface-soft)}
/* Active item: solid accent pill, RySwift signature */
.peritix-next .sidebar-invo-link.active{color:#fff!important;background:var(--px-accent);box-shadow:0 8px 18px color-mix(in srgb,var(--px-accent) 30%,transparent)}
.peritix-next .sidebar-invo-link.active::before{display:none}
.peritix-next .sidebar-invo-link.active svg{color:#fff!important}
.peritix-next .sidebar-collapse-btn{right:-15px;width:30px;height:46px;border-color:var(--px-line);border-radius:12px;background:var(--px-surface);box-shadow:var(--px-shadow)}
.peritix-next .sidebar-invo-bottom{padding:.7rem;border-top-color:var(--px-line);background:transparent}
.peritix-next .sidebar-customize-trigger{min-height:30px;margin-bottom:.2rem;color:var(--px-faint);font-size:.66rem}
.peritix-next .sidebar-account-trigger{border-radius:13px}
.peritix-next .sidebar-account-trigger:hover{background:var(--px-surface-soft)}

/* ============ 6. Header ============ */
.peritix-next .header.header-invo{height:66px;border-bottom-color:var(--px-line);background:color-mix(in srgb,var(--px-surface) 82%,transparent);backdrop-filter:blur(18px) saturate(150%)}
.peritix-next .header-invo-search{width:min(430px,38vw);border-color:transparent;border-radius:13px;background:var(--px-surface-soft)}
.peritix-next .header-invo-search:focus-within{border-color:color-mix(in srgb,var(--px-accent) 26%,transparent);background:var(--px-surface);box-shadow:0 0 0 4px color-mix(in srgb,var(--px-accent) 9%,transparent)}
.peritix-next .header-invo-icon-btn{border-color:var(--px-line);border-radius:12px;background:var(--px-surface);color:#5b6076;transition:border-color var(--px-ease),color var(--px-ease),transform var(--px-ease)}
.peritix-next .header-invo-icon-btn:hover{border-color:color-mix(in srgb,var(--px-accent) 30%,var(--px-line));color:var(--px-accent-deep);transform:translateY(-1px)}

/* ============ 7. Tabs (pill navigation) ============ */
.peritix-next .accounting-tabs,.peritix-next .settings-tabs,.peritix-next .tab-list,.peritix-next .tabs,.peritix-next .tabs-strip,.peritix-next .ficha-subnav{border-color:var(--px-line);border-radius:14px;background:var(--px-surface-soft);box-shadow:none}
.peritix-next .accounting-tabs button,.peritix-next .tab-btn{border-radius:10px;color:var(--px-muted);font-weight:700;transition:background var(--px-ease),color var(--px-ease),box-shadow var(--px-ease)}
.peritix-next .accounting-tabs button:hover,.peritix-next .tab-btn:hover{background:color-mix(in srgb,var(--px-accent) 7%,transparent);color:var(--px-ink)}
.peritix-next .accounting-tabs button.active,.peritix-next .tab-btn.active,.peritix-next .settings-tab.active{color:#fff;background:var(--px-navy);box-shadow:0 6px 14px rgba(26,33,48,.22)}
.peritix-next .tab-btn.active.is-accent,.peritix-next .ficha-evidence-tab.is-active{color:#fff;background:var(--px-accent);box-shadow:0 6px 14px color-mix(in srgb,var(--px-accent) 26%,transparent)}

/* ============ 8. Tables ============ */
.peritix-next .table-card{overflow:hidden}
.peritix-next .responsive-table{border-collapse:separate;border-spacing:0}
.peritix-next .responsive-table thead th{height:46px;border-color:var(--px-line);color:var(--px-faint);background:var(--px-surface-soft);font-size:.66rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase}
.peritix-next .responsive-table tbody td{border-color:var(--px-line-soft);color:#3c4157}
.peritix-next .responsive-table tbody tr{transition:background .14s ease}
.peritix-next .responsive-table tbody tr:hover{background:var(--px-accent-softer)}
.peritix-next .accounting-table th{color:var(--px-faint);font-weight:800}
.peritix-next .accounting-table tbody tr:hover{background:var(--px-accent-softer)}

/* ============ 9. Forms ============ */
.peritix-next .form-input,.peritix-next input,.peritix-next select,.peritix-next textarea{border-color:var(--px-line);border-radius:12px;background:var(--px-surface-soft);color:var(--px-ink);transition:border-color var(--px-ease),box-shadow var(--px-ease),background var(--px-ease)}
.peritix-next .form-input:focus,.peritix-next input:focus,.peritix-next select:focus,.peritix-next textarea:focus{border-color:color-mix(in srgb,var(--px-accent) 55%,#fff);background:var(--px-surface);box-shadow:0 0 0 4px color-mix(in srgb,var(--px-accent) 10%,transparent);outline:none}
.peritix-next .form-label{color:#4a4f63;font-weight:700}

/* ============ 10. Badges and status pills ============ */
.peritix-next .status-pill,.peritix-next .badge{border-radius:999px;font-weight:700;letter-spacing:.01em}
.peritix-next .badge-primary{color:var(--px-accent-deep);background:var(--px-accent-soft)}
.peritix-next .badge-success{color:var(--px-green);background:var(--px-green-soft)}
.peritix-next .badge-warning{color:var(--px-amber);background:var(--px-amber-soft)}

/* ============ 11. KPI system: navy spotlight card + deltas ============ */
.peritix-next .dashboard-metrics-grid{gap:.8rem}
.peritix-next .dashboard-metric{position:relative;overflow:hidden;min-height:116px;padding:1.05rem;border-top:0}
.peritix-next .dashboard-metric::after{position:absolute;right:-26px;bottom:-33px;width:96px;height:96px;border:16px solid currentColor;border-radius:50%;content:'';opacity:.05}
.peritix-next .dashboard-metric:nth-child(4n+1){color:var(--px-accent)}
.peritix-next .dashboard-metric:nth-child(4n+2){color:var(--px-green)}
.peritix-next .dashboard-metric:nth-child(4n+3){color:var(--px-amber)}
.peritix-next .dashboard-metric:nth-child(4n+4){color:#e04f8d}
.peritix-next .dashboard-metric-value{color:currentColor;font-size:1.95rem;font-weight:800;letter-spacing:-.03em}
/* Spotlight: first KPI goes navy, RySwift signature */
.peritix-next .dashboard-metrics-grid>.dashboard-metric:first-child{color:#fff;border-color:transparent;background:var(--px-navy);box-shadow:0 16px 36px rgba(26,33,48,.24)}
.peritix-next .dashboard-metrics-grid>.dashboard-metric:first-child .dashboard-metric-value,.peritix-next .dashboard-metrics-grid>.dashboard-metric:first-child .dashboard-metric-label,.peritix-next .dashboard-metrics-grid>.dashboard-metric:first-child small,.peritix-next .dashboard-metrics-grid>.dashboard-metric:first-child span{color:#fff!important}
.peritix-next .dashboard-metrics-grid>.dashboard-metric:first-child:hover{border-color:transparent;background:var(--px-navy-soft)}
/* Delta pill: "+20%" style variation next to big numerals */
.peritix-next .px-delta{display:inline-flex;align-items:center;gap:.18rem;padding:.16rem .5rem;border-radius:999px;color:var(--px-green);background:var(--px-green-soft);font-size:.68rem;font-weight:800;white-space:nowrap;letter-spacing:0}
.peritix-next .px-delta.is-negative{color:var(--px-red);background:var(--px-red-soft)}
.peritix-next .px-delta.is-neutral{color:var(--px-muted);background:var(--px-surface-soft)}
.peritix-next .px-delta.is-amber{color:var(--px-amber);background:var(--px-amber-soft)}
.peritix-next .dashboard-metrics-grid>.dashboard-metric:first-child .px-delta{color:#ffd84d;background:rgba(255,216,77,.14)}

/* Manager KPI row, RySwift style: flat white cards, dark numerals, colored icon chip */
.peritix-next .manager-kpi{min-height:106px;padding:.9rem .95rem;border-color:var(--px-line);border-radius:var(--px-radius);background:var(--px-surface);box-shadow:var(--px-shadow)}
.peritix-next .manager-kpi::after{border-color:color-mix(in srgb,var(--manager-tone) 7%,transparent)}
.peritix-next .manager-kpi:hover{border-color:color-mix(in srgb,var(--manager-tone) 30%,var(--px-line));box-shadow:var(--px-shadow-hover)}
.peritix-next .manager-kpi-icon{width:40px;height:40px;border-radius:12px}
.peritix-next .manager-kpi-copy{grid-template-columns:1fr;gap:.1rem}
.peritix-next .manager-kpi-copy small{color:var(--px-faint);font-weight:800}
.peritix-next .manager-kpi-copy strong{display:flex;flex-wrap:wrap;align-items:center;gap:.45rem;color:var(--px-ink);font-size:1.8rem;font-weight:800;letter-spacing:-.03em}
.peritix-next .manager-kpi-copy em{color:var(--px-muted)}
.peritix-next .manager-kpi-arrow{color:var(--px-faint)}
/* Sparkline of mini bars inside the spotlight KPI */
.peritix-next .manager-kpi-spark{display:flex;align-items:flex-end;gap:3px;height:34px}
.peritix-next .manager-kpi-spark i{width:5px;height:var(--h);min-height:4px;border-radius:3px;background:rgba(255,255,255,.32)}
.peritix-next .manager-kpi-spark i:last-child{background:#c4b5fd}
/* Spotlight: first manager KPI goes navy, RySwift signature */
.peritix-next .manager-kpis>.manager-kpi:first-child{border-color:transparent;background:radial-gradient(circle at 92% 0%,rgba(255,255,255,.08),transparent 42%),var(--px-navy);box-shadow:0 16px 36px rgba(26,33,48,.24);color:#fff}
.peritix-next .manager-kpis>.manager-kpi:first-child::after{border-color:rgba(255,255,255,.05)}
.peritix-next .manager-kpis>.manager-kpi:first-child .manager-kpi-icon{background:rgba(255,255,255,.12);color:#fff}
.peritix-next .manager-kpis>.manager-kpi:first-child .manager-kpi-copy small{color:rgba(255,255,255,.6)}
.peritix-next .manager-kpis>.manager-kpi:first-child .manager-kpi-copy strong{color:#fff}
.peritix-next .manager-kpis>.manager-kpi:first-child .manager-kpi-copy em{color:rgba(255,255,255,.55)}
.peritix-next .manager-kpis>.manager-kpi:first-child .px-delta{color:#1a2130;background:#ffd84d}
.peritix-next .manager-kpis>.manager-kpi:first-child .px-delta.is-negative{color:#fff;background:#e04f6f}
.peritix-next .manager-kpis>.manager-kpi:first-child:hover{border-color:transparent;background:radial-gradient(circle at 92% 0%,rgba(255,255,255,.1),transparent 42%),var(--px-navy-soft);box-shadow:0 20px 44px rgba(26,33,48,.3)}

/* ============ 12. Dashboard layout and existing manager/perito sections ============ */
.peritix-next .dashboard-shell,.peritix-next .manager-dashboard{gap:1.05rem}
/* Hero: navy spotlight panel instead of rainbow gradient */
.peritix-next .dashboard-hero{overflow:hidden;border:0;border-radius:24px;background:radial-gradient(circle at 88% 8%,rgba(255,255,255,.09),transparent 22rem),var(--px-navy);box-shadow:0 18px 42px rgba(26,33,48,.22)}
.peritix-next .dashboard-hero h1,.peritix-next .dashboard-hero h2,.peritix-next .dashboard-hero h3,.peritix-next .dashboard-hero .dashboard-title,.peritix-next .dashboard-hero .dashboard-kicker,.peritix-next .dashboard-hero .dashboard-description{color:#fff}
.peritix-next .dashboard-hero .dashboard-description{opacity:.72}
.peritix-next .dashboard-layout,.peritix-next .manager-main-grid{grid-template-columns:minmax(0,1.75fr) minmax(280px,.68fr);gap:.9rem}
.peritix-next .dashboard-panel{overflow:hidden}
.peritix-next .dashboard-task-row,.peritix-next .dashboard-queue-item,.peritix-next .dashboard-pipeline-row{border-color:var(--px-line);border-radius:13px;background:var(--px-surface-soft)}
.peritix-next .dashboard-task-row:hover,.peritix-next .dashboard-queue-item:hover{background:var(--px-surface);box-shadow:var(--px-shadow-hover);transform:translateY(-1px)}

.peritix-next .manager-dashboard-page>.page-head,.peritix-next .perito-cockpit~*{position:relative}
.peritix-next .manager-cockpit,.peritix-next .perito-cockpit{display:grid;gap:1rem}
.peritix-next .manager-kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:.85rem}

.peritix-next .manager-insight-grid{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(240px,.58fr);gap:.9rem}
.peritix-next .manager-insight-chart,.peritix-next .manager-insight-sla{min-height:228px;padding:1.15rem;border:1px solid var(--px-line);border-radius:var(--px-radius);background:var(--px-surface);box-shadow:var(--px-shadow)}
.peritix-next .manager-insight-head{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}
.peritix-next .manager-insight-head>div{display:grid;gap:.14rem}
.peritix-next .manager-insight-head span{color:var(--px-faint);font-size:.62rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.peritix-next .manager-insight-head strong{color:var(--px-ink);font-size:.95rem}
.peritix-next .manager-insight-head>small{padding:.3rem .55rem;border-radius:999px;color:var(--px-muted);background:var(--px-surface-soft);font-size:.65rem;text-transform:capitalize}
.peritix-next .manager-insight-bars{display:grid;grid-template-columns:repeat(3,1fr);align-items:end;gap:1.2rem;height:112px;margin:1rem 1rem .55rem;padding:0 1.2rem;border-bottom:1px solid var(--px-line);background:repeating-linear-gradient(to top,transparent 0,transparent 27px,var(--px-line-soft) 28px)}
.peritix-next .manager-insight-bars>span{display:flex;align-items:end;justify-content:center;height:100%}
.peritix-next .manager-insight-bars i{display:block;width:min(58px,55%);height:var(--bar-height);min-height:10px;border-radius:10px 10px 3px 3px;transition:height .45s cubic-bezier(.33,1,.38,1)}
/* RySwift chart treatment: accent bar pops, siblings stay pale */
.peritix-next .manager-insight-bars .is-entered i,.peritix-next .manager-insight-legend .is-entered{background:var(--px-accent)}
.peritix-next .manager-insight-bars .is-closed i,.peritix-next .manager-insight-legend .is-closed{background:color-mix(in srgb,var(--px-accent) 32%,#fff)}
.peritix-next .manager-insight-bars .is-balance i,.peritix-next .manager-insight-legend .is-balance{background:color-mix(in srgb,var(--px-accent) 14%,#fff)}
.peritix-next .manager-insight-legend{display:flex;align-items:center;justify-content:center;gap:1rem;color:var(--px-muted);font-size:.65rem}
.peritix-next .manager-insight-legend span{display:flex;align-items:center;gap:.3rem}
.peritix-next .manager-insight-legend i{width:7px;height:7px;border-radius:50%}
.peritix-next .manager-insight-legend b{color:var(--px-ink)}
.peritix-next .manager-insight-sla{display:grid;place-items:center;text-align:center;background:radial-gradient(circle at 50% 65%,var(--px-accent-softer),transparent 55%),var(--px-surface)}
.peritix-next .manager-insight-sla .manager-insight-head{width:100%;text-align:left}
.peritix-next .manager-sla-ring{position:relative;display:grid;width:112px;height:112px;margin:.35rem 0;place-content:center;border-radius:50%;background:radial-gradient(circle,var(--px-surface) 57%,transparent 59%),conic-gradient(var(--px-accent) var(--sla),var(--px-line) 0)}
.peritix-next .manager-sla-ring::after{position:absolute;inset:8px;border:1px solid var(--px-line-soft);border-radius:50%;content:''}
.peritix-next .manager-sla-ring strong{color:var(--px-accent);font-size:1.5rem;font-weight:800}
.peritix-next .manager-sla-ring small{color:var(--px-faint);font-size:.6rem}
.peritix-next .manager-insight-sla p{margin:0;color:var(--px-muted);font-size:.68rem}
.peritix-next .manager-main-grid{grid-template-columns:minmax(0,1.65fr) minmax(290px,.65fr)}
.peritix-next .manager-panel{border:1px solid var(--px-line);border-radius:var(--px-radius);background:var(--px-surface);box-shadow:var(--px-shadow)}
.peritix-next .manager-attention-row{min-height:60px}
.peritix-next .manager-person{min-height:70px}
.peritix-next .manager-month-strip{overflow:hidden;border:1px solid var(--px-line);border-radius:19px;background:var(--px-surface);box-shadow:var(--px-shadow)}
.peritix-next .manager-month-title{background:var(--px-navy)}

.peritix-next .perito-hero{display:grid;grid-template-columns:minmax(230px,.72fr) minmax(0,1.7fr);min-height:184px;padding:1.2rem;border:1px solid transparent;border-radius:24px;background:radial-gradient(circle at 88% 10%,rgba(255,255,255,.09),transparent 20rem),var(--px-navy);box-shadow:0 18px 42px rgba(26,33,48,.22)}
.peritix-next .perito-hero-copy{align-content:center;padding:1rem}
.peritix-next .perito-hero-copy>span{color:#c9b8ff}
.peritix-next .perito-hero-copy strong{max-width:320px;color:#fff;font-size:clamp(1.55rem,2.3vw,2.25rem);font-family:Inter,sans-serif;line-height:1.02;letter-spacing:-.03em}
.peritix-next .perito-hero-copy small{max-width:310px;color:rgba(255,255,255,.66)}
.peritix-next .perito-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem}
.peritix-next .perito-kpi{min-height:72px;padding:.75rem;border:1px solid var(--px-line);border-radius:16px;color:#596078;background:var(--px-surface);box-shadow:none}
.peritix-next .perito-kpi:hover{border-color:color-mix(in srgb,var(--px-accent) 22%,var(--px-line));background:var(--px-surface);box-shadow:var(--px-shadow-hover)}
.peritix-next .perito-kpi-icon{background:var(--perito-soft);color:var(--perito-tone)}
.peritix-next .perito-kpi small{color:var(--px-faint)}
.peritix-next .perito-kpi strong{color:var(--perito-tone);font-size:1.35rem;font-weight:800}
.peritix-next .perito-kpi em{color:var(--px-faint)}
.peritix-next .perito-kpi>svg{color:#c4c8d5}
.peritix-next .perito-kpi.is-blue{--perito-tone:var(--px-accent);--perito-soft:var(--px-accent-soft)}
.peritix-next .perito-kpi.is-red{--perito-tone:var(--px-red);--perito-soft:var(--px-red-soft)}
.peritix-next .perito-kpi.is-amber{--perito-tone:var(--px-amber);--perito-soft:var(--px-amber-soft)}
.peritix-next .perito-kpi.is-cyan{--perito-tone:#0e9aa8;--perito-soft:#e5f8fa}
.peritix-next .perito-workspace-grid{grid-template-columns:minmax(0,1.8fr) minmax(280px,.7fr);gap:.9rem}
.peritix-next .perito-focus-panel,.peritix-next .perito-side-panel{border:1px solid var(--px-line);border-radius:var(--px-radius);background:var(--px-surface);box-shadow:var(--px-shadow)}
.peritix-next .perito-focus-row{min-height:64px}
.peritix-next .perito-priority-index{background:var(--px-accent-soft);color:var(--px-accent-deep)}
.peritix-next .perito-panel-head>div>span{color:var(--px-accent-deep)}

/* ============ 13. Ficha expediente workspace ============ */
.peritix-next .ficha-case-hero{border-color:var(--px-line);border-radius:24px;background:radial-gradient(circle at 89% -10%,var(--px-accent-soft),transparent 31%),linear-gradient(130deg,var(--px-surface) 0%,var(--px-surface-soft) 100%);box-shadow:var(--px-shadow)}
.peritix-next .ficha-case-reference{color:var(--px-ink);font-weight:800!important}
.peritix-next .ficha-next-action{border-color:color-mix(in srgb,var(--px-green) 20%,var(--px-line));border-radius:15px;background:linear-gradient(90deg,var(--px-green-soft),#f6fffa)}
.peritix-next .ficha-status-flow,.peritix-next .ficha-info-card,.peritix-next .ficha-operational-core,.peritix-next .ficha-evidence-hub{border-color:var(--px-line)!important;border-radius:var(--px-radius)!important;box-shadow:var(--px-shadow)}
.peritix-next .ficha-status-step{border-radius:12px!important}
.peritix-next .ficha-status-step.is-active{color:var(--px-accent-deep)!important;border-color:color-mix(in srgb,var(--px-accent) 30%,var(--px-line))!important;background:var(--px-accent-soft)!important}
.peritix-next .ficha-subnav{border-color:var(--px-line);border-radius:15px;background:color-mix(in srgb,var(--px-surface) 90%,transparent);backdrop-filter:blur(14px)}
.peritix-next .ficha-evidence-tabs{gap:.55rem;padding:.65rem;border-bottom-color:var(--px-line);background:var(--px-surface-soft)}
.peritix-next .ficha-evidence-tab{border:1px solid transparent;border-radius:13px;background:transparent}
.peritix-next .ficha-evidence-tab.is-active{border-color:var(--px-line);color:var(--px-accent-deep);background:var(--px-surface);box-shadow:var(--px-shadow)}
.peritix-next .ficha-evidence-panel{background:var(--px-surface)}
.peritix-next .ficha-operational-core-heading{background:radial-gradient(circle at 89% 10%,rgba(255,255,255,.09),transparent 30%),var(--px-navy)}
.peritix-next .ficha-operational-core-heading span,.peritix-next .ficha-operational-core-metrics small{color:#c3c9dd}
.peritix-next .ficha-operational-core-grid{background:linear-gradient(180deg,var(--px-surface),var(--px-surface-soft))}
.peritix-next .ficha-activity-item{border-color:var(--px-line);border-radius:13px;background:var(--px-surface-soft)}

/* ============ 14. Modals, popovers, empty and loading states ============ */
.peritix-next .modal-content,.peritix-next .modal-card,.peritix-next .dashboard-settings-dialog,.peritix-next .sidebar-tools-panel,.peritix-next .header-invo-popover{border-color:var(--px-line);border-radius:22px;box-shadow:0 28px 72px rgba(23,26,43,.22)}
.peritix-next .dashboard-settings-backdrop,.peritix-next .modal-backdrop{background:rgba(23,26,43,.42);backdrop-filter:blur(5px)}
.peritix-next .empty-state,.peritix-next .dashboard-empty{min-height:150px;border:1px dashed #dcdfea;border-radius:18px;color:var(--px-muted);background:radial-gradient(circle at 50% 0%,var(--px-accent-softer),transparent 58%),var(--px-surface-soft)}
.peritix-next [aria-busy='true'],.peritix-next .skeleton{background:linear-gradient(90deg,#eef0f5 25%,#f8f9fc 45%,#eef0f5 65%);background-size:220% 100%;animation:px-shimmer 1.4s ease-in-out infinite}
@keyframes px-shimmer{to{background-position:-220% 0}}

/* ============ 15. Motion: page entrance and micro-interactions ============ */
.peritix-next .app-content>*{animation:px-rise .34s cubic-bezier(.33,1,.38,1) both}
.peritix-next .app-content>*:nth-child(2){animation-delay:.04s}
.peritix-next .app-content>*:nth-child(3){animation-delay:.08s}
.peritix-next .app-content>*:nth-child(4){animation-delay:.11s}
.peritix-next .app-content>*:nth-child(5){animation-delay:.14s}
@keyframes px-rise{from{opacity:0;transform:translateY(9px)}to{opacity:1;transform:none}}
.peritix-next .manager-sla-ring strong{animation:px-pop .5s cubic-bezier(.33,1.4,.38,1) both .15s}
@keyframes px-pop{from{opacity:0;transform:scale(.82)}to{opacity:1;transform:scale(1)}}

/* ============ 16. Responsive ============ */
@media(max-width:1180px){.peritix-next .dashboard-layout,.peritix-next .manager-main-grid{grid-template-columns:minmax(0,1fr)}.peritix-next .dashboard-secondary-column,.peritix-next .manager-side-column{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:1100px){.peritix-next .manager-insight-grid,.peritix-next .manager-main-grid,.peritix-next .perito-hero,.peritix-next .perito-workspace-grid{grid-template-columns:1fr}.peritix-next .perito-hero-copy{padding:.25rem}.peritix-next .perito-kpis{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:768px){.peritix-next{--px-radius:16px;background:var(--px-canvas)}.peritix-next .app-content{padding:.85rem .75rem 5rem}.peritix-next .header.header-invo{height:58px}.peritix-next .header-invo-search{width:min(56vw,340px)}.peritix-next .dashboard-metrics-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.peritix-next .dashboard-metric{min-height:96px}.peritix-next .dashboard-secondary-column,.peritix-next .manager-side-column{grid-template-columns:1fr}.peritix-next .ficha-case-hero,.peritix-next .ficha-status-flow,.peritix-next .ficha-evidence-hub{border-radius:16px!important}.peritix-next .ficha-operational-core-summary,.peritix-next .ficha-operational-core-metrics{flex-wrap:wrap;justify-content:flex-start}.peritix-next .responsive-table{min-width:760px}}
@media(max-width:760px){.peritix-next .manager-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.peritix-next .manager-insight-grid{display:none}.peritix-next .perito-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.peritix-next .perito-hero{padding:.8rem}.peritix-next .perito-hero-copy strong{font-size:1.55rem}}
@media(max-width:480px){.peritix-next .dashboard-metrics-grid{grid-template-columns:1fr}.peritix-next .dashboard-metric{min-height:88px}.peritix-next .btn{min-height:42px}}
@media(prefers-reduced-motion:reduce){.peritix-next *,.peritix-next *::before,.peritix-next *::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}

/* iOS Safari amplía un input enfocado si su texto se calcula por debajo de
   16px. La búsqueda vive en la cabecera (fuera de algunos contenedores de la
   app), por eso se protege expresamente aquí, en la última hoja cargada. */
@media(max-width:768px){
  .peritix-next .header-invo-search-input{
    font-size:16px!important;
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
  }
  .peritix-next .header-invo-search-results{
    top:calc(58px + env(safe-area-inset-top, 0px))!important;
    max-height:calc(var(--peritix-visible-viewport-height, 100dvh) - 70px - env(safe-area-inset-top, 0px))!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }
}

/* ============ 17. Dark theme ============ */
:root[data-theme='dark'] .peritix-next{
  --px-accent:#8b5cf6;
  --px-accent-deep:#a78bfa;
  --px-accent-soft:rgba(139,92,246,.16);
  --px-accent-softer:rgba(139,92,246,.09);
  --px-navy:#0e1322;
  --px-navy-soft:#151b2e;
  --px-canvas:#0b0f1c;
  --px-surface:#141a2b;
  --px-surface-soft:#101626;
  --px-line:#232b42;
  --px-line-soft:#1c2338;
  --px-ink:#eef1fb;
  --px-muted:#98a1ba;
  --px-faint:#6d7690;
  --px-green:#34d399;
  --px-green-soft:rgba(52,211,153,.13);
  --px-red:#f87171;
  --px-red-soft:rgba(248,113,113,.12);
  --px-amber:#fbbf24;
  --px-amber-soft:rgba(251,191,36,.12);
  --px-shadow:0 1px 2px rgba(0,0,0,.28),0 10px 28px rgba(0,0,0,.3);
  --px-shadow-hover:0 3px 8px rgba(0,0,0,.3),0 18px 40px rgba(0,0,0,.4);
  background:radial-gradient(circle at 82% -12%,rgba(139,92,246,.08),transparent 30rem),var(--px-canvas);
}
:root[data-theme='dark'] .peritix-next .dashboard-metrics-grid>.dashboard-metric:first-child{background:#1d2440;box-shadow:0 16px 36px rgba(0,0,0,.4)}
:root[data-theme='dark'] .peritix-next .manager-kpi{border-color:var(--px-line);background:var(--px-surface)}
:root[data-theme='dark'] .peritix-next .manager-kpi-copy strong{color:var(--px-ink)}
:root[data-theme='dark'] .peritix-next .manager-kpis>.manager-kpi:first-child{background:radial-gradient(circle at 92% 0%,rgba(255,255,255,.07),transparent 42%),#1d2440;box-shadow:0 16px 36px rgba(0,0,0,.42)}
:root[data-theme='dark'] .peritix-next .manager-kpis>.manager-kpi:first-child .manager-kpi-copy strong{color:#fff}
:root[data-theme='dark'] .peritix-next .sidebar-invo-link.active{box-shadow:0 8px 18px rgba(139,92,246,.3)}
:root[data-theme='dark'] .peritix-next .accounting-tabs button.active,:root[data-theme='dark'] .peritix-next .tab-btn.active,:root[data-theme='dark'] .peritix-next .settings-tab.active{background:#2a3350;box-shadow:0 6px 14px rgba(0,0,0,.35)}
:root[data-theme='dark'] .peritix-next .dashboard-hero,:root[data-theme='dark'] .peritix-next .perito-hero,:root[data-theme='dark'] .peritix-next .ficha-operational-core-heading{background:radial-gradient(circle at 88% 8%,rgba(255,255,255,.07),transparent 22rem),#151b2e}
:root[data-theme='dark'] .peritix-next .responsive-table tbody tr:hover,:root[data-theme='dark'] .peritix-next .accounting-table tbody tr:hover{background:rgba(139,92,246,.07)}
:root[data-theme='dark'] .peritix-next .empty-state,:root[data-theme='dark'] .peritix-next .dashboard-empty{border-color:#2a3350;background:radial-gradient(circle at 50% 0%,rgba(139,92,246,.07),transparent 58%),var(--px-surface-soft)}

/* La fila del rol (pastilla Perito/Gerente) no lleva fondo ni borde: solo la pastilla. */
.peritix-next .sidebar-workspace-block>.sidebar-role-row{background:transparent!important;border:0!important;border-radius:0!important;padding:.35rem .15rem 0!important}
