/* Payroll Argentina - estilos locales.
   La interfaz funciona sin CDN: este archivo define layout, componentes y
   estados. AdminLTE/Bootstrap se cargan antes solo como mejora progresiva. */

:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #f1f5f9;
  --text: #172033;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --border: #dfe6ef;
  --border-strong: #cbd5e1;
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --primary-soft: #e9efff;
  --accent: #0f766e;
  --accent-soft: #e6f7f4;
  --success: #0f766e;
  --success-soft: #e7f7f1;
  --warning: #a05a00;
  --warning-soft: #fff7e6;
  --danger: #b42318;
  --danger-soft: #feecec;
  --info: #1d4ed8;
  --info-soft: #e9f1ff;
  --sidebar-bg: #0b172a;
  --sidebar-bg-2: #10233f;
  --sidebar-text: #9bacc6;
  --sidebar-active: #ffffff;
  --sidebar-width: 256px;
  --header-height: 68px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px rgba(15, 23, 42, 0.035);
  --shadow-float: 0 18px 45px rgba(15, 23, 42, 0.14);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body.app-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.icon {
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -0.18em;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
  color: #fff;
}

/* --------------------------------------------------------------------------
   Layout general
   -------------------------------------------------------------------------- */

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

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  background:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.18), transparent 35%),
    linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
}

.brand-link:hover {
  color: #fff;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8 58%, #0f766e);
  box-shadow: 0 8px 22px rgba(29, 78, 216, 0.38);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-text {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.brand-text strong {
  color: #fff;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.brand-text small {
  color: #8ca0bd;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px 20px;
}

.sidebar-heading {
  margin: 20px 10px 7px;
  color: #647a9a;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.sidebar-heading:first-child {
  margin-top: 8px;
}

.sidebar-nav .nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 2px 0;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 550;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-nav .nav-link.is-active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.09));
  color: var(--sidebar-active);
  font-weight: 650;
}

.sidebar-nav .nav-link.is-active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -12px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #60a5fa;
  content: "";
}

.sidebar-nav .nav-icon {
  width: 18px;
  height: 18px;
  color: #7f94b3;
  transition: color 0.15s ease;
}

.sidebar-nav .nav-link:hover .nav-icon,
.sidebar-nav .nav-link.is-active .nav-icon {
  color: #93c5fd;
}

.sidebar-footer {
  margin: 0 12px 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
}

.sidebar-footer p {
  margin: 7px 0 0;
  color: #7387a5;
  font-size: 10.5px;
  line-height: 1.45;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #c7d6ea;
  font-size: 11.5px;
  font-weight: 650;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16);
}

.app-main {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin-left: var(--sidebar-width);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.header-left,
.header-right {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}

.header-right {
  flex: 0 0 auto;
}

.breadcrumb-wrap {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  background: transparent;
  font-size: 11.5px;
  list-style: none;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-light);
}

.breadcrumb li + li::before {
  color: var(--muted-light);
  content: "/";
}

.breadcrumb a {
  color: var(--muted);
  font-weight: 550;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .current {
  color: var(--text-soft);
  font-weight: 650;
}

.header-context {
  overflow: hidden;
  max-width: 56vw;
  color: var(--muted-light);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-content: center;
  gap: 4px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.icon-button span {
  display: block;
  width: 17px;
  height: 1.8px;
  border-radius: 2px;
  background: var(--text-soft);
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--surface-soft);
}

.header-health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid #cfeee4;
  border-radius: 999px;
  background: #f3fcf9;
  color: #176b58;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.header-health:hover {
  border-color: #9fe0cf;
  color: #0f5e4c;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.avatar {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid #d6e3ff;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.avatar--admin {
  background: linear-gradient(145deg, #e8efff, #dbe7ff);
}

.avatar--accent {
  border-color: #c8ece5;
  background: var(--accent-soft);
  color: var(--accent);
}

.avatar--warm {
  border-color: #f6e3c4;
  background: #fff8ea;
  color: #98600d;
}

.user-meta {
  display: grid;
  line-height: 1.2;
}

.user-meta strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.user-meta small {
  color: var(--muted-light);
  font-size: 10.5px;
}

.app-content {
  width: 100%;
  max-width: 1680px;
  flex: 1;
  align-self: center;
  padding: 26px 30px 42px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 30px 22px;
  color: var(--muted-light);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Encabezado de pagina
   -------------------------------------------------------------------------- */

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-eyebrow {
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(24px, 2.4vw, 31px);
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.page-heading p {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Tarjetas y grillas
   -------------------------------------------------------------------------- */

.card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.card + .card {
  margin-top: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
}

.card-header--plain {
  border-bottom: 0;
  padding-bottom: 0;
}

.card-title {
  float: none;
  margin: 0;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.card-body {
  padding: 20px;
}

.card-body--flush {
  padding: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  display: flex;
  min-width: 0;
  gap: 14px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.stat-card::after {
  position: absolute;
  top: -30px;
  right: -28px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(29, 78, 216, 0.07), transparent 70%);
  content: "";
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid #d6e3ff;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon--accent {
  border-color: #c8ece5;
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-icon--warm {
  border-color: #f6e3c4;
  background: var(--warning-soft);
  color: var(--warning);
}

.stat-icon--violet {
  border-color: #e3d9ff;
  background: #f3efff;
  color: #6d3fd4;
}

.stat-content {
  min-width: 0;
}

.stat-label {
  overflow: hidden;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value {
  margin: 0;
  color: var(--text);
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1.12;
}

.stat-meta {
  margin: 4px 0 0;
  color: var(--muted-light);
  font-size: 10.5px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.82fr);
  gap: 18px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 18px;
}

.stack > .card + .card {
  margin-top: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

/* --------------------------------------------------------------------------
   Tablas
   -------------------------------------------------------------------------- */

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

table.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

table.data-table th {
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

table.data-table td {
  padding: 13px 20px;
  border-bottom: 1px solid #ecf1f7;
  color: var(--text-soft);
  font-size: 12.5px;
  vertical-align: middle;
}

table.data-table tbody tr:last-child td {
  border-bottom: 0;
}

table.data-table tbody tr:hover td {
  background: #fafcff;
}

table.data-table .num {
  text-align: right;
  white-space: nowrap;
}

table.data-table .strong {
  color: var(--text);
  font-weight: 650;
}

table.data-table .nowrap {
  white-space: nowrap;
}

.entity-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 190px;
}

.entity-text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.entity-name {
  overflow: hidden;
  color: var(--text);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-meta {
  overflow: hidden;
  color: var(--muted-light);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
}

.text-end {
  text-align: right;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Badges, botones y alertas
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.badge--success {
  border-color: #c7ebdf;
  background: var(--success-soft);
  color: #0f6b53;
}

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

.badge--danger {
  border-color: #f7cccc;
  background: var(--danger-soft);
  color: var(--danger);
}

.badge--info {
  border-color: #cbdcff;
  background: var(--info-soft);
  color: var(--info);
}

.badge--neutral {
  border-color: #e3e9f1;
  background: var(--surface-muted);
  color: #52637a;
}

.badge--violet {
  border-color: #e3d9ff;
  background: #f3efff;
  color: #6d3fd4;
}

.badge--outline {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--muted);
}

.badge .status-dot {
  width: 6px;
  height: 6px;
  flex-basis: 6px;
  box-shadow: none;
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  color: var(--text);
}

.btn:focus-visible,
.icon-button:focus-visible,
.input:focus-visible,
.select:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.2);
  outline-offset: 1px;
}

.btn--primary {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 5px 14px rgba(29, 78, 216, 0.2);
  color: #fff;
}

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

.btn--outline {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--text-soft);
}

.btn--outline:hover {
  border-color: #b7c5d8;
  background: var(--surface-soft);
}

.btn--ghost {
  color: var(--primary);
}

.btn--ghost:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn--success {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.btn--success:hover {
  background: #0b5f58;
  color: #fff;
}

.btn--danger {
  border-color: #f2c4c4;
  background: #fff7f7;
  color: var(--danger);
}

.btn--danger:hover {
  border-color: #e9a9a9;
  background: var(--danger-soft);
}

.btn--sm {
  min-height: 31px;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 11px;
}

.btn[disabled],
.btn[aria-disabled="true"],
.btn.disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 15px;
  border: 1px solid;
  border-radius: 10px;
  font-size: 12.5px;
}

.alert .icon {
  margin-top: 1px;
}

.alert--success {
  border-color: #c7ebdf;
  background: #f3fcf9;
  color: #0f5e4c;
}

.alert--warning {
  border-color: #f6e0b4;
  background: #fffbf2;
  color: #7c4b00;
}

.alert--danger {
  border-color: #f7cccc;
  background: #fff7f7;
  color: #8d1f1f;
}

.alert--info {
  border-color: #cbdcff;
  background: #f5f8ff;
  color: #1e3a8a;
}

.alert strong {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Formularios y filtros
   -------------------------------------------------------------------------- */

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfe;
}

.field {
  display: flex;
  min-width: 160px;
  flex-direction: column;
  gap: 5px;
}

.field--grow {
  min-width: 230px;
  flex: 1;
}

.field label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.field .label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Zona de arrastre para alta de convenios (propuestas-ia/nuevo). */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text-soft);
  text-align: center;
  cursor: pointer;
}

.dropzone:hover {
  border-color: var(--primary);
}

.dropzone:focus-within {
  border-color: var(--primary);
  outline: 3px solid rgba(29, 78, 216, 0.14);
}

.dropzone--dragover {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-soft);
}

.dropzone-text {
  font-size: 13px;
}

.dropzone-file {
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.dropzone-input {
  /* Entrada nativa como alternativa accesible: operable con teclado y
     lector de pantalla, sin duplicar la interfaz visual. */
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dropzone-error {
  margin: 0;
  color: var(--danger);
  font-size: 12.5px;
}

.dropzone-progress {
  width: 100%;
  height: 6px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.dropzone-progress > span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  animation: dropzone-busy 1.1s ease-in-out infinite alternate;
}

@keyframes dropzone-busy {
  from {
    margin-left: -40%;
  }
  to {
    margin-left: 100%;
  }
}

.input,
.select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
}

.input::placeholder {
  color: var(--muted-light);
}

.input:focus,
.select:focus {
  border-color: #9db7ee;
  outline: 3px solid rgba(29, 78, 216, 0.13);
  outline-offset: 0;
}

.select {
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  appearance: none;
}

.search-control {
  position: relative;
}

.search-control .icon {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--muted-light);
  transform: translateY(-50%);
}

.search-control .input {
  padding-left: 34px;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding-bottom: 1px;
}

.filter-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 11.5px;
}

.filter-summary strong {
  color: var(--text-soft);
}

/* --------------------------------------------------------------------------
   Estados vacios y errores
   -------------------------------------------------------------------------- */

.empty-state {
  display: grid;
  max-width: 520px;
  margin: 0 auto;
  padding: 52px 24px;
  place-items: center;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 13px;
  place-items: center;
  border: 1px solid #d6e3ff;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-icon .icon {
  width: 24px;
  height: 24px;
}

.empty-state h2,
.empty-state h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 420px;
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 12.5px;
}

.empty-state--page {
  min-height: 52vh;
  max-width: 620px;
}

.error-code {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

/* --------------------------------------------------------------------------
   Listas de datos, resumen y detalle
   -------------------------------------------------------------------------- */

.summary-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.summary-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px dashed #e6edf5;
}

.summary-row:first-child {
  padding-top: 0;
}

.summary-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.summary-row dt,
.summary-label {
  flex: 0 1 auto;
  color: var(--muted);
  font-size: 11.5px;
}

.summary-row dd,
.summary-value {
  margin: 0;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  text-align: right;
  word-break: break-word;
}

.summary-row dd.num,
.summary-value.num {
  font-variant-numeric: tabular-nums;
}

.summary-row--total {
  margin-top: 8px;
  padding: 13px 0;
  border-top: 1px solid var(--border-strong);
  border-bottom: 0;
}

.summary-row--total dt,
.summary-row--total dd {
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.detail-list {
  display: grid;
  gap: 13px;
  margin: 0;
}

.detail-item {
  display: grid;
  gap: 2px;
}

.detail-item dt {
  color: var(--muted-light);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-item dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.detail-item dd.strong {
  color: var(--text);
  font-weight: 700;
}

.list-plain {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid #edf2f8;
}

.list-row:first-child {
  padding-top: 0;
}

.list-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.list-row-main {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.list-row-main strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row-main small {
  color: var(--muted-light);
  font-size: 10.5px;
}

.list-row-side {
  flex: 0 0 auto;
  text-align: right;
}

.list-row-side strong {
  display: block;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.list-row-side small {
  color: var(--muted-light);
  font-size: 10.5px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef6;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #0f766e);
}

.progress-row {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.progress-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 10.5px;
}

.quick-actions {
  display: grid;
  gap: 8px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text-soft);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.quick-action:hover {
  border-color: #bcd0f5;
  background: #f8fbff;
  color: var(--primary-dark);
  transform: translateX(2px);
}

.quick-action .quick-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.quick-action .quick-icon--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.quick-action .quick-icon--warm {
  background: var(--warning-soft);
  color: var(--warning);
}

.quick-action .quick-icon--violet {
  background: #f3efff;
  color: #6d3fd4;
}

.quick-action-text {
  display: grid;
  line-height: 1.28;
}

.quick-action-text strong {
  font-size: 12px;
  font-weight: 650;
}

.quick-action-text small {
  color: var(--muted-light);
  font-size: 10px;
}

/* --------------------------------------------------------------------------
   Convenios, propuestas y salud
   -------------------------------------------------------------------------- */

.agreement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.agreement-card {
  display: flex;
  min-height: 215px;
  flex-direction: column;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.agreement-card:hover {
  border-color: #c4d5f2;
}

.agreement-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.agreement-code {
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.agreement-card h2 {
  margin: 5px 0 6px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.agreement-scope {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11.5px;
}

.agreement-summary {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.48;
}

.agreement-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--border);
  color: var(--muted-light);
  font-size: 10.5px;
}

.agreement-stats {
  display: flex;
  gap: 16px;
}

.agreement-stats strong {
  display: block;
  color: var(--text-soft);
  font-size: 12.5px;
}

.agreement-stats small {
  color: var(--muted-light);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rule-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.rule-index {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 750;
}

.confidence {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.confidence strong {
  color: var(--text);
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -0.04em;
}

.confidence span {
  color: var(--muted);
  font-size: 11px;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.health-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.health-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--muted);
}

.health-icon--ok {
  background: var(--success-soft);
  color: var(--success);
}

.health-icon--error {
  background: var(--danger-soft);
  color: var(--danger);
}

.health-icon--demo {
  background: var(--info-soft);
  color: var(--info);
}

.health-body {
  min-width: 0;
  flex: 1;
}

.health-body-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.health-body h3 {
  margin: 0;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
}

.health-body p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
}

.health-body small {
  display: block;
  margin-top: 4px;
  color: var(--muted-light);
  font-size: 10px;
}

/* --------------------------------------------------------------------------
   Detalle / recibos
   -------------------------------------------------------------------------- */

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 11.5px;
  list-style: none;
}

.meta-strip li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-strip .icon {
  width: 14px;
  height: 14px;
  color: var(--muted-light);
}

.receipt-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.receipt-frame-wrap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #e8edf5;
}

.receipt-frame {
  display: block;
  width: 100%;
  height: 840px;
  border: 0;
  background: #e8edf5;
}

.receipt-lines {
  display: grid;
  gap: 0;
}

.receipt-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid #edf2f8;
  font-size: 12px;
}

.receipt-line:last-child {
  border-bottom: 0;
}

.receipt-line span {
  color: var(--muted);
}

.receipt-line strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.receipt-line--total {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border-strong);
}

.receipt-line--total span,
.receipt-line--total strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.callout {
  padding: 13px 15px;
  border-left: 3px solid var(--primary);
  border-radius: 0 9px 9px 0;
  background: #f5f8ff;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.callout--warning {
  border-left-color: #d99a20;
  background: #fffbf2;
}

.callout--success {
  border-left-color: var(--accent);
  background: #f2fbf8;
}

.callout strong {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
  background: rgba(4, 12, 26, 0.48);
  backdrop-filter: blur(2px);
}

@media (max-width: 1240px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .dashboard-grid,
  .detail-grid,
  .receipt-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 991px) {
  .app-sidebar {
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.sidebar-open .app-sidebar {
    visibility: visible;
    transform: translateX(0);
    box-shadow: var(--shadow-float);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .app-main {
    margin-left: 0;
  }

  .app-header {
    padding: 0 18px;
  }

  .app-content {
    padding: 21px 18px 34px;
  }

  .app-footer {
    padding: 14px 18px 20px;
  }

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

@media (min-width: 992px) {
  [data-sidebar-toggle] {
    display: none;
  }
}

@media (max-width: 720px) {
  .stats-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .agreement-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .header-health span:last-child,
  .user-meta,
  .header-context {
    display: none;
  }

  .header-health {
    padding: 7px;
  }

  .user-chip {
    padding-left: 10px;
  }

  .filters-bar {
    align-items: stretch;
  }

  .field,
  .field--grow {
    min-width: 100%;
  }

  .filter-actions {
    width: 100%;
    margin-left: 0;
  }

  .filter-actions .btn {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .app-content {
    padding: 18px 12px 30px;
  }

  .app-header {
    padding: 0 12px;
  }

  .card-header,
  .card-body,
  .filters-bar {
    padding-right: 14px;
    padding-left: 14px;
  }

  table.data-table th,
  table.data-table td {
    padding-right: 14px;
    padding-left: 14px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Sesión y login
   -------------------------------------------------------------------------- */

.logout-form {
  display: flex;
  margin: 0;
}

.logout-form .btn {
  white-space: nowrap;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(59, 130, 246, 0.16), transparent 34%),
    radial-gradient(circle at 82% 88%, rgba(15, 118, 110, 0.14), transparent 36%),
    var(--bg);
}

.login-shell {
  width: 100%;
  max-width: 430px;
}

.login-card {
  padding: 34px 34px 30px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login-brand strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.login-brand small {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-card h1 {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.login-card > p {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 12.5px;
}

.login-form {
  display: grid;
  gap: 9px;
}

.login-form label {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 700;
}

.login-form input[type="email"],
.login-form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(29, 78, 216, 0.14);
}

.login-form .btn {
  justify-content: center;
  margin-top: 16px;
  padding: 10px 14px;
}

.login-footer {
  margin: 22px 0 0;
  color: var(--muted-light);
  font-size: 10.5px;
  text-align: center;
}

@media (max-width: 520px) {
  .login-card {
    padding: 26px 20px 22px;
  }
}
