/* ==========================================================================
   1. Design Tokens
   --------------------------------------------------------------------------
   Foundations for the visual system. These tokens intentionally coexist with
   Tailwind CDN classes used by the current templates.
   ========================================================================== */

:root {
  /* Legacy brand scale kept for compatibility with existing styles. */
  --brand-950: #022c22;
  --brand-900: #064e3b;
  --brand-800: #065f46;
  --brand-700: #047857;
  --brand-500: #10b981;

  /* Brand / institutional identity. */
  --color-brand-primary: #047857;
  --color-brand-primary-hover: #065f46;
  --color-brand-primary-active: #064e3b;
  --color-brand-primary-subtle: #ecfdf5;
  --color-brand-primary-muted: #a7f3d0;
  --color-brand-on-primary: #ffffff;

  /* Surfaces. */
  --color-bg-app: #f6f8f7;
  --color-bg-surface: #ffffff;
  --color-bg-surface-subtle: #f8fafc;
  --color-bg-surface-elevated: #ffffff;
  --color-bg-muted: #f1f5f9;

  /* Text. */
  --color-text-primary: #0f172a;
  --color-text-secondary: #334155;
  --color-text-muted: #64748b;
  --color-text-disabled: #94a3b8;
  --color-text-inverse: #f8fafc;

  /* Borders. */
  --color-border-subtle: #f1f5f9;
  --color-border-default: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-border-hover: #94a3b8;
  --color-border-focus: #10b981;

  /* Semantic states. Brand and success are intentionally separated. */
  --color-success: #16a34a;
  --color-success-hover: #15803d;
  --color-success-subtle: #dcfce7;
  --color-success-border: #86efac;
  --color-success-text: #166534;

  --color-warning: #d97706;
  --color-warning-subtle: #fffbeb;
  --color-warning-border: #fcd34d;
  --color-warning-text: #92400e;

  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-danger-subtle: #fef2f2;
  --color-danger-border: #fecaca;
  --color-danger-text: #991b1b;

  --color-info: #2563eb;
  --color-info-subtle: #eff6ff;
  --color-info-border: #bfdbfe;
  --color-info-text: #1e40af;

  /* Typography. */
  --font-family-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-size-display: 1.875rem;
  --line-height-display: 2.25rem;
  --font-size-section-title: 1.125rem;
  --line-height-section-title: 1.75rem;
  --font-size-card-title: 1rem;
  --line-height-card-title: 1.5rem;
  --font-size-body: .875rem;
  --line-height-body: 1.5rem;
  --font-size-body-sm: .8125rem;
  --line-height-body-sm: 1.25rem;
  --font-size-caption: .75rem;
  --line-height-caption: 1rem;
  --font-size-label: .875rem;
  --line-height-label: 1.25rem;
  --font-size-helper: .75rem;
  --line-height-helper: 1.25rem;
  --font-size-table-header: .7rem;
  --line-height-table-header: 1rem;
  --font-size-numeric: .875rem;
  --line-height-numeric: 1.25rem;

  /* Spacing. */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-page-x: 1.5rem;
  --space-page-y: 1.5rem;
  --space-section-gap: 1.5rem;
  --space-card-padding: 1.25rem;
  --space-form-gap: 1.25rem;
  --space-field-gap: .375rem;
  --space-table-cell-x: 1rem;
  --space-table-cell-y: .7rem;
  --space-table-cell-x-compact: .75rem;
  --space-table-cell-y-compact: .52rem;
  --space-table-cell-x-comfortable: 1.1rem;
  --space-table-cell-y-comfortable: .82rem;
  --space-toolbar-gap: .75rem;
  --space-modal-padding: 1.5rem;

  /* Radius. */
  --radius-sm: .375rem;
  --radius-md: .5rem;
  --radius-lg: .75rem;
  --radius-xl: 1rem;

  /* Shadows. */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);

  /* Focus and motion. */
  --focus-ring: 0 0 0 4px rgba(16, 185, 129, .14);
  --focus-outline: 3px solid rgba(16, 185, 129, .34);
  --motion-duration-fast: 120ms;
  --motion-duration-base: 160ms;
  --motion-duration-slow: 200ms;
  --motion-ease-standard: cubic-bezier(.2, 0, .2, 1);
}

/* ==========================================================================
   2. Base / Reset complementario
   ========================================================================== */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

body {
  background: var(--color-bg-app);
  color: var(--color-text-secondary);
  font-family: var(--font-family-sans);
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ==========================================================================
   3. Typography
   ========================================================================== */

.ui-title-display {
  color: var(--color-text-primary);
  font-size: var(--font-size-display);
  font-weight: 800;
  letter-spacing: 0;
  line-height: var(--line-height-display);
}

.ui-title-section {
  color: var(--color-text-primary);
  font-size: var(--font-size-section-title);
  font-weight: 800;
  letter-spacing: 0;
  line-height: var(--line-height-section-title);
}

.ui-title-card {
  color: var(--color-text-primary);
  font-size: var(--font-size-card-title);
  font-weight: 800;
  letter-spacing: 0;
  line-height: var(--line-height-card-title);
}

.ui-body {
  color: var(--color-text-secondary);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.ui-body-small {
  color: var(--color-text-muted);
  font-size: var(--font-size-body-sm);
  line-height: var(--line-height-body-sm);
}

.ui-caption {
  color: var(--color-text-muted);
  font-size: var(--font-size-caption);
  line-height: var(--line-height-caption);
}

.ui-form-label {
  color: var(--color-text-secondary);
  font-size: var(--font-size-label);
  font-weight: 700;
  line-height: var(--line-height-label);
}

.ui-helper-text {
  color: var(--color-text-muted);
  font-size: var(--font-size-helper);
  line-height: var(--line-height-helper);
}

.ui-numeric,
.numeric-data {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.campo-numerico {
  text-align: right;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.cell-number,
.cell-money,
.cell-percent,
.cell-date,
.cell-document {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.cell-text {
  text-align: left;
}

.cell-number,
.cell-money,
.cell-percent {
  text-align: right;
}

.cell-date,
.cell-code,
.cell-document,
.cell-status,
.cell-actions {
  white-space: nowrap;
}

.cell-code {
  color: var(--color-text-secondary);
  font-weight: 800;
  letter-spacing: .01em;
}

.cell-document {
  color: var(--color-text-secondary);
  font-weight: 700;
}

.cell-money {
  color: var(--color-text-primary);
  font-weight: 800;
}

.cell-money-negative {
  color: var(--color-danger-text);
}

.cell-money-zero {
  color: var(--color-text-muted);
  font-weight: 700;
}

.cell-actions {
  text-align: right;
}

/* Los dialogos se renderizan en el top layer, pero conservan propiedades
   heredadas de la celda que los declara. Restablece el flujo de texto para
   evitar desbordes horizontales en formularios de resolucion. */
dialog[id^="rechazo-"] {
  max-width: calc(100vw - 2rem);
  overflow: hidden;
  white-space: normal;
}

dialog[id^="rechazo-"] form,
dialog[id^="rechazo-"] .form-help {
  max-width: 100%;
  min-width: 0;
  white-space: normal;
}

dialog[id^="rechazo-"] .form-help {
  overflow-wrap: anywhere;
}

.cell-truncate {
  display: inline-block;
  max-width: min(28rem, 52vw);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

/* ==========================================================================
   4. Layout Utilities
   ========================================================================== */

.ui-page-shell {
  margin-inline: auto;
  max-width: 1500px;
}

.app-body {
  background:
    linear-gradient(180deg, #f8fafc 0%, #f3f7f6 42%, #f8fafc 100%);
}

.app-shell {
  background:
    linear-gradient(90deg, rgba(5, 46, 43, .035), transparent 18rem),
    var(--color-bg-app);
}

.app-workspace {
  background: transparent;
}

.app-main {
  border-left: 1px solid rgba(15, 23, 42, .06);
}

@media (max-width: 1023px) {
  .app-main {
    border-left: 0;
  }
}

.ui-surface {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}

.ui-surface-subtle {
  background: var(--color-bg-surface-subtle);
  border: 1px solid var(--color-border-default);
}

.ui-toolbar {
  align-items: center;
  display: flex;
  gap: var(--space-toolbar-gap);
}

/* ==========================================================================
   5. Shared UI Primitives
   ========================================================================== */

.btn,
.primary-button,
.secondary-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: inline-flex;
  font-size: var(--font-size-body);
  font-weight: 700;
  gap: .5rem;
  justify-content: center;
  line-height: 1.25rem;
  min-height: 2.75rem;
  padding: .65rem 1rem;
  text-decoration: none;
  transition:
    background-color var(--motion-duration-base) var(--motion-ease-standard),
    border-color var(--motion-duration-base) var(--motion-ease-standard),
    box-shadow var(--motion-duration-base) var(--motion-ease-standard),
    color var(--motion-duration-base) var(--motion-ease-standard),
    transform var(--motion-duration-fast) var(--motion-ease-standard);
  user-select: none;
  white-space: nowrap;
}

.btn:hover,
.primary-button:hover,
.secondary-button:hover {
  text-decoration: none;
}

.btn:active,
.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"],
.primary-button:disabled,
.primary-button[aria-disabled="true"],
.secondary-button:disabled,
.secondary-button[aria-disabled="true"],
.btn-disabled {
  cursor: not-allowed;
  opacity: .58;
  pointer-events: none;
}

.btn-primary,
.primary-button {
  background: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-xs);
  color: var(--color-brand-on-primary);
}

.btn-primary:hover,
.primary-button:hover {
  background: var(--color-brand-primary-hover);
  border-color: var(--color-brand-primary-hover);
  color: var(--color-brand-on-primary);
}

.btn-primary:active,
.primary-button:active {
  background: var(--color-brand-primary-active);
  border-color: var(--color-brand-primary-active);
}

.btn-secondary,
.secondary-button {
  background: var(--color-bg-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text-secondary);
}

.btn-secondary:hover,
.secondary-button:hover {
  background: var(--color-bg-surface-subtle);
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text-secondary);
}

.btn-outline:hover {
  background: var(--color-bg-surface-subtle);
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
}

.btn-danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-brand-on-primary);
}

.btn-danger:hover {
  background: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
}

.btn-success {
  background: var(--color-success);
  border-color: var(--color-success);
  color: var(--color-brand-on-primary);
}

.btn-success:hover {
  background: var(--color-success-hover);
  border-color: var(--color-success-hover);
}

.btn-sm {
  border-radius: var(--radius-md);
  font-size: var(--font-size-caption);
  min-height: 2.25rem;
  padding: .45rem .75rem;
}

.btn-md {
  min-height: 2.75rem;
  padding: .65rem 1rem;
}

.btn-lg {
  min-height: 3rem;
  padding: .75rem 1.25rem;
}

.btn-icon {
  aspect-ratio: 1;
  flex: none;
  min-height: 2.5rem;
  min-width: 2.5rem;
  padding: 0;
}

.btn-loading {
  color: transparent;
  pointer-events: none;
  position: relative;
}

.btn-loading::after {
  animation: ui-spin .8s linear infinite;
  border: 2px solid rgba(255, 255, 255, .78);
  border-right-color: transparent;
  border-top-color: transparent;
  border-radius: 9999px;
  content: "";
  height: 1rem;
  left: calc(50% - .5rem);
  position: absolute;
  top: calc(50% - .5rem);
  width: 1rem;
}

input,
select,
textarea {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  color: var(--color-text-primary);
  min-height: 3rem;
  padding: .7rem .9rem;
  transition:
    border-color var(--motion-duration-base) var(--motion-ease-standard),
    box-shadow var(--motion-duration-base) var(--motion-ease-standard),
    background-color var(--motion-duration-base) var(--motion-ease-standard);
  width: 100%;
}

input[type="checkbox"] {
  accent-color: var(--color-brand-primary);
  border-radius: .3rem;
  height: 1.15rem;
  min-height: 1.15rem;
  padding: 0;
  width: 1.15rem;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--color-border-hover);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-border-focus);
  box-shadow: var(--focus-ring);
  outline: none;
}

.status-pill,
.status-badge,
.badge {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9999px;
  display: inline-flex;
  font-size: .7rem;
  font-weight: 800;
  gap: .35rem;
  line-height: 1rem;
  padding: .28rem .62rem;
  white-space: nowrap;
}

.status-pill {
  background: var(--color-brand-primary-subtle);
  border-color: var(--color-brand-primary-muted);
  color: var(--color-brand-primary);
  font-weight: 700;
}

.status-active {
  background: var(--color-success-subtle);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}

.status-neutral {
  background: var(--color-bg-muted);
  border-color: var(--color-border-default);
  color: var(--color-text-muted);
}

.badge-neutral,
.badge-draft,
.badge-borrador {
  background: var(--color-bg-muted);
  border-color: var(--color-border-default);
  color: var(--color-text-muted);
}

.badge-success,
.badge-active,
.badge-activo,
.badge-approved,
.badge-aprobado {
  background: var(--color-success-subtle);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}

.badge-info,
.badge-pending,
.badge-pendiente {
  background: var(--color-info-subtle);
  border-color: var(--color-info-border);
  color: var(--color-info-text);
}

.badge-warning,
.badge-vencido {
  background: var(--color-warning-subtle);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}

.badge-danger,
.badge-error,
.badge-rejected,
.badge-rechazado,
.badge-anulado,
.badge-inactive,
.badge-inactivo {
  background: var(--color-danger-subtle);
  border-color: var(--color-danger-border);
  color: var(--color-danger-text);
}

.alert {
  align-items: flex-start;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  color: var(--color-text-secondary);
  display: flex;
  gap: .75rem;
  padding: .9rem 1rem;
}

.alert-icon {
  align-items: center;
  border-radius: 9999px;
  display: inline-flex;
  flex: none;
  font-size: .75rem;
  font-weight: 900;
  height: 1.35rem;
  justify-content: center;
  margin-top: .05rem;
  width: 1.35rem;
}

.alert-title {
  color: var(--color-text-primary);
  display: block;
  font-size: var(--font-size-body);
  font-weight: 800;
  line-height: var(--line-height-label);
}

.alert-message {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.alert-success {
  background: var(--color-success-subtle);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}

.alert-info {
  background: var(--color-info-subtle);
  border-color: var(--color-info-border);
  color: var(--color-info-text);
}

.alert-warning {
  background: var(--color-warning-subtle);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}

.alert-danger,
.alert-error {
  background: var(--color-danger-subtle);
  border-color: var(--color-danger-border);
  color: var(--color-danger-text);
}

.alert-neutral {
  background: var(--color-bg-surface-subtle);
  border-color: var(--color-border-default);
  color: var(--color-text-secondary);
}

.alert-success .alert-icon,
.toast-success .toast-icon { background: var(--color-success); color: #fff; }
.alert-info .alert-icon,
.toast-info .toast-icon { background: var(--color-info); color: #fff; }
.alert-warning .alert-icon,
.toast-warning .toast-icon { background: var(--color-warning); color: #fff; }
.alert-danger .alert-icon,
.alert-error .alert-icon,
.toast-danger .toast-icon,
.toast-error .toast-icon { background: var(--color-danger); color: #fff; }
.alert-neutral .alert-icon,
.toast-neutral .toast-icon { background: var(--color-text-muted); color: #fff; }

.toast {
  align-items: flex-start;
  background: var(--color-bg-surface-elevated);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  color: var(--color-text-secondary);
  display: flex;
  gap: .75rem;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: .9rem 1rem;
  pointer-events: auto;
}

.toast-icon {
  align-items: center;
  border-radius: 9999px;
  display: inline-flex;
  flex: none;
  font-size: .75rem;
  font-weight: 900;
  height: 1.35rem;
  justify-content: center;
  width: 1.35rem;
}

.toast-message {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.form-field {
  display: block;
}

.form-label {
  color: var(--color-text-secondary);
  display: block;
  font-size: var(--font-size-label);
  font-weight: 700;
  line-height: var(--line-height-label);
  margin-bottom: var(--space-field-gap);
}

.form-required {
  color: var(--color-danger);
  font-weight: 900;
  margin-left: .2rem;
}

.form-control,
.form-select {
  width: 100%;
}

.form-help {
  color: var(--color-text-muted);
  font-size: var(--font-size-helper);
  line-height: var(--line-height-helper);
  margin-top: .35rem;
}

.form-error-text {
  color: var(--color-danger-text);
  font-size: var(--font-size-body-sm);
  font-weight: 700;
  line-height: var(--line-height-body-sm);
  margin-top: .35rem;
}

.form-section {
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  background: var(--color-bg-surface);
  padding: var(--space-card-padding);
}

.form-section-title {
  color: var(--color-text-primary);
  font-size: var(--font-size-section-title);
  font-weight: 800;
  line-height: var(--line-height-section-title);
}

.form-actions {
  align-items: center;
  border-top: 1px solid var(--color-border-default);
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: var(--space-form-gap);
  padding-top: var(--space-5);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly],
textarea[readonly] {
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.app-card,
.surface-panel {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.surface-muted {
  background: var(--color-bg-surface-subtle);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
}

.app-card-header {
  border-bottom: 1px solid var(--color-border-default);
  padding: var(--space-5);
}

.app-card-title {
  color: var(--color-text-primary);
  font-size: var(--font-size-card-title);
  font-weight: 800;
  line-height: var(--line-height-card-title);
}

.app-card-description {
  color: var(--color-text-muted);
  font-size: var(--font-size-body-sm);
  line-height: var(--line-height-body-sm);
  margin-top: .25rem;
}

.app-card-body {
  padding: var(--space-5);
}

.app-card-footer {
  background: var(--color-bg-surface-subtle);
  border-top: 1px solid var(--color-border-default);
  padding: var(--space-4) var(--space-5);
}

.table-action {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: .6rem;
  color: var(--color-brand-primary);
  cursor: pointer;
  display: inline-flex;
  font-size: .78rem;
  font-weight: 700;
  min-height: 2.25rem;
  padding: 0 .6rem;
  text-decoration: none;
}

.table-action:hover {
  background: var(--color-brand-primary-subtle);
  color: var(--color-brand-primary-hover);
  text-decoration: none;
}

.table-action:disabled,
.table-action[aria-disabled="true"] {
  color: var(--color-text-disabled);
  cursor: not-allowed;
  opacity: .72;
}

.table-action-danger {
  color: var(--color-danger-text);
}

.table-action-danger:hover {
  background: var(--color-danger-subtle);
  color: var(--color-danger-text);
}

.table-action-secondary {
  color: var(--color-text-muted);
}

.table-action-secondary:hover {
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
}

.table-actions,
.row-actions {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: .25rem;
  justify-content: flex-end;
}

.table-action-icon {
  justify-content: center;
  min-width: 2.25rem;
  padding-inline: .45rem;
}

.pagination-link {
  align-items: center;
  border: 1px solid var(--color-border-default);
  border-radius: .65rem;
  color: var(--color-text-muted);
  display: inline-flex;
  font-weight: 700;
  min-height: 2.5rem;
  padding: 0 .8rem;
}

.pagination {
  align-items: center;
  border-top: 1px solid var(--color-border-default);
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  padding: .75rem 1rem;
}

.pagination-summary {
  color: var(--color-text-muted);
  font-size: var(--font-size-body);
}

.pagination-actions {
  display: flex;
  gap: .5rem;
}

.pagination-link:hover {
  background: var(--color-bg-surface-subtle);
  color: var(--color-text-primary);
}

.pagination-link[aria-current="page"],
.pagination-link-current {
  background: var(--color-brand-primary-subtle);
  border-color: var(--color-brand-primary-muted);
  color: var(--color-brand-primary);
}

.pagination-link-disabled,
.pagination-link[aria-disabled="true"] {
  color: var(--color-text-disabled);
  cursor: not-allowed;
  opacity: .7;
  pointer-events: none;
}

.empty-state {
  color: var(--color-text-muted);
  padding: 2.5rem 1rem;
  text-align: center;
}

.empty-state h3 {
  color: var(--color-text-secondary);
  font-weight: 800;
  margin-top: .8rem;
}

.empty-state p {
  font-size: var(--font-size-body);
  margin-top: .35rem;
}

.empty-icon {
  background: var(--color-bg-muted);
  border-radius: 9999px;
  display: grid;
  font-size: 1.3rem;
  height: 3rem;
  margin: auto;
  place-items: center;
  width: 3rem;
}

.empty-state-action {
  margin-top: 1rem;
}

.loading-inline {
  align-items: center;
  color: var(--color-text-muted);
  display: inline-flex;
  font-size: var(--font-size-body);
  gap: .5rem;
}

.loading-spinner {
  animation: ui-spin .8s linear infinite;
  border: 2px solid var(--color-border-strong);
  border-right-color: var(--color-brand-primary);
  border-top-color: var(--color-brand-primary);
  border-radius: 9999px;
  display: inline-block;
  height: 1rem;
  width: 1rem;
}

.loading-region {
  opacity: .72;
  pointer-events: none;
}

.skeleton {
  animation: ui-pulse 1.4s ease-in-out infinite;
  background: linear-gradient(90deg, var(--color-bg-muted), var(--color-border-default), var(--color-bg-muted));
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  min-height: 1rem;
}

.htmx-indicator {
  opacity: 0;
  transition: opacity var(--motion-duration-base) var(--motion-ease-standard);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

.modal-overlay {
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(6px);
}

.modal-panel {
  background: var(--color-bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal-header,
.modal-body {
  padding: var(--space-modal-padding);
}

.modal-title {
  color: var(--color-text-primary);
  font-size: var(--font-size-section-title);
  font-weight: 800;
  line-height: var(--line-height-section-title);
}

.modal-description {
  color: var(--color-text-muted);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.modal-footer {
  background: var(--color-bg-surface-subtle);
  border-top: 1px solid var(--color-border-default);
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  padding: var(--space-4);
}

.modal-icon {
  align-items: center;
  border-radius: var(--radius-lg);
  display: grid;
  flex: none;
  height: 3rem;
  place-items: center;
  width: 3rem;
}

.modal-icon-danger {
  background: var(--color-danger-subtle);
  color: var(--color-danger-text);
}

.modal-icon-success {
  background: var(--color-success-subtle);
  color: var(--color-success-text);
}

.action-link {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: var(--font-size-body-sm);
  font-weight: 700;
  gap: .35rem;
  min-height: 2rem;
  padding: .25rem .5rem;
  text-decoration: none;
}

.action-link:hover {
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
  text-decoration: none;
}

.action-link-primary {
  color: var(--color-brand-primary);
}

.action-link-primary:hover {
  background: var(--color-brand-primary-subtle);
  color: var(--color-brand-primary-hover);
}

.action-link-danger {
  color: var(--color-danger-text);
}

.action-link-danger:hover {
  background: var(--color-danger-subtle);
  color: var(--color-danger-text);
}

.action-icon {
  align-items: center;
  border-radius: var(--radius-md);
  display: inline-flex;
  flex: none;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.action-menu-trigger {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
}

.action-menu-trigger:hover {
  background: var(--color-bg-muted);
  border-color: var(--color-border-default);
  color: var(--color-text-primary);
}

.form-error {
  background: var(--color-danger-subtle);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--radius-lg);
  color: var(--color-danger-text);
  font-size: var(--font-size-body);
  font-weight: 600;
  padding: .85rem 1rem;
}

.field-group-error input,
.field-group-error select,
.field-group-error textarea {
  background: var(--color-danger-subtle);
  border-color: var(--color-danger-border);
}

.data-table-shell {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.data-table-toolbar {
  align-items: stretch;
  background: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border-default);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-toolbar-gap);
  padding: var(--space-4);
}

.data-table-toolbar > * {
  min-width: 0;
}

.data-table-toolbar-primary {
  flex: 1 1 22rem;
}

.data-table-toolbar-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: .5rem;
}

.data-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--color-border-strong) transparent;
  scrollbar-width: thin;
}

.data-table-scroll::-webkit-scrollbar {
  height: .7rem;
}

.data-table-scroll::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border: 2px solid var(--color-bg-surface);
  border-radius: 9999px;
}

.data-table-scroll::-webkit-scrollbar-track {
  background: var(--color-bg-surface-subtle);
}

.data-table-footer {
  background: var(--color-bg-surface);
  border-top: 1px solid var(--color-border-default);
}

.data-table-loading {
  align-items: center;
  display: flex;
  min-height: 2.25rem;
  padding: .55rem 1rem;
}

.data-table th {
  background: var(--color-bg-surface-subtle);
  color: var(--color-text-muted);
  font-size: var(--font-size-table-header);
  font-weight: 800;
  letter-spacing: .06em;
  line-height: var(--line-height-table-header);
  padding: var(--space-table-cell-y) var(--space-table-cell-x);
  text-align: left;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

.sortable-th {
  padding: 0;
}

.sortable-th-link {
  align-items: center;
  color: inherit;
  display: inline-flex;
  gap: .35rem;
  min-height: 2.25rem;
  padding: var(--space-table-cell-y) var(--space-table-cell-x);
  text-decoration: none;
  width: 100%;
}

.data-table-compact .sortable-th-link,
.data-table-density-compact .sortable-th-link {
  padding: var(--space-table-cell-y-compact) var(--space-table-cell-x-compact);
}

.sortable-th-link:hover {
  color: var(--color-text-primary);
}

.sortable-th-link:focus-visible {
  border-radius: var(--radius-sm);
  outline: var(--focus-outline);
  outline-offset: -2px;
}

.sortable-th.cell-number .sortable-th-link,
.sortable-th.cell-money .sortable-th-link,
.sortable-th.cell-percent .sortable-th-link {
  justify-content: flex-end;
}

.sortable-th-active {
  color: var(--color-brand-primary);
}

.sortable-th-icon {
  color: var(--color-text-subtle);
  font-size: .72rem;
  line-height: 1;
}

.sortable-th-active .sortable-th-icon {
  color: var(--color-brand-primary);
}

.data-table td {
  border-top: 1px solid var(--color-border-subtle);
  color: var(--color-text-muted);
  font-size: var(--font-size-body);
  padding: var(--space-table-cell-y) var(--space-table-cell-x);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--color-bg-surface-subtle);
}

.data-table tbody tr:focus-within {
  background: var(--color-brand-primary-subtle);
}

.data-table-compact th,
.data-table-density-compact th,
.data-table-compact td,
.data-table-density-compact td {
  padding: var(--space-table-cell-y-compact) var(--space-table-cell-x-compact);
}

.data-table-comfortable th,
.data-table-density-comfortable th,
.data-table-comfortable td,
.data-table-density-comfortable td {
  padding: var(--space-table-cell-y-comfortable) var(--space-table-cell-x-comfortable);
}

.data-table-sticky-header thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table-sticky-first th:first-child,
.data-table-sticky-first td:first-child {
  background: var(--color-bg-surface);
  box-shadow: 1px 0 0 var(--color-border-subtle);
  left: 0;
  position: sticky;
  z-index: 1;
}

.data-table-sticky-first thead th:first-child {
  background: var(--color-bg-surface-subtle);
  z-index: 3;
}

.data-table-sticky-actions th:last-child,
.data-table-sticky-actions td:last-child {
  background: var(--color-bg-surface);
  box-shadow: -1px 0 0 var(--color-border-subtle);
  position: sticky;
  right: 0;
  z-index: 1;
}

.data-table-sticky-actions thead th:last-child {
  background: var(--color-bg-surface-subtle);
  z-index: 3;
}

.data-table th.cell-number,
.data-table th.cell-money,
.data-table th.cell-percent,
.data-table th.cell-actions,
.data-table td.cell-number,
.data-table td.cell-money,
.data-table td.cell-percent,
.data-table td.cell-actions {
  text-align: right;
}

.data-table-form input,
.data-table-form select,
.data-table-form textarea {
  font-size: var(--font-size-body-sm);
  min-height: 2.5rem;
  padding: .55rem .65rem;
}

.data-table-form .form-error-text {
  line-height: 1.15rem;
  margin-top: .35rem;
}

.data-table td.cell-empty {
  padding: 0;
}

.data-table td.cell-empty .empty-state {
  border: 0;
  margin-inline: 0;
  width: min(calc(100vw - 4rem), 32rem);
}

@keyframes ui-spin {
  to { transform: rotate(360deg); }
}

@keyframes ui-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   6. Accessibility / Focus
   ========================================================================== */

.focus-ring:focus-visible,
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* ==========================================================================
   7. Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* ==========================================================================
   8. Existing Compatibility Styles
   --------------------------------------------------------------------------
   Kept to avoid breaking current templates. These should be migrated gradually
   to the tokens and shared primitives above.
   ========================================================================== */

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .045), transparent 18rem),
    linear-gradient(180deg, #042f2e 0%, #053f3a 48%, #052b34 100%);
}

.sidebar-brand {
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  box-shadow: inset 0 -1px rgba(2, 44, 34, .55);
}

.sidebar-nav {
  scrollbar-color: rgba(167, 243, 208, .35) transparent;
  scrollbar-width: thin;
}

.brand-mark {
  background: linear-gradient(145deg, #34d399, #047857);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

.nav-label {
  color: rgba(167, 243, 208, .55);
}

.nav-item {
  border: 1px solid transparent;
  color: rgba(236, 253, 245, .72);
  outline-offset: 2px;
  transition:
    background-color var(--motion-duration-slow) var(--motion-ease-standard),
    border-color var(--motion-duration-slow) var(--motion-ease-standard),
    color var(--motion-duration-slow) var(--motion-ease-standard),
    transform var(--motion-duration-slow) var(--motion-ease-standard);
}

.nav-item:hover {
  background: rgba(255, 255, 255, .075);
  border-color: rgba(167, 243, 208, .12);
  color: #fff;
  transform: translateX(2px);
}

.nav-item:focus-visible {
  outline: var(--focus-outline);
}

.nav-item svg {
  color: rgba(167, 243, 208, .82);
}

.nav-item-active {
  background: linear-gradient(90deg, rgba(16, 185, 129, .26), rgba(16, 185, 129, .11));
  border-color: rgba(110, 231, 183, .18);
  box-shadow: inset 3px 0 #34d399;
  color: #fff;
}

.nav-item-active svg {
  color: #a7f3d0;
}

.nav-item-disabled {
  color: rgba(236, 253, 245, .42);
  cursor: default;
}

.nav-item-disabled:hover {
  background: transparent;
  border-color: transparent;
  color: rgba(236, 253, 245, .42);
  transform: none;
}

.nav-item-sub {
  color: rgba(236, 253, 245, .62);
  font-size: .82rem;
  margin-left: .65rem;
}

.topbar {
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid rgba(203, 213, 225, .82);
  backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .025);
}

.topbar-inner {
  margin-inline: auto;
  max-width: 1920px;
}

.topbar-branch {
  background: #fff;
  border: 1px solid var(--color-border-default);
}

.topbar-branch:hover {
  background: var(--color-brand-primary-subtle);
  border-color: var(--color-brand-primary-muted);
}

.app-footer {
  background: rgba(255, 255, 255, .72);
  border-top: 1px solid rgba(203, 213, 225, .72);
}

.avatar { background: linear-gradient(145deg, #0f766e, var(--color-brand-primary)); }
.module-icon-emerald { color: var(--color-brand-primary); background: var(--color-brand-primary-subtle); }
.module-icon-blue { color: #1d4ed8; background: var(--color-info-subtle); }
.module-icon-amber { color: #b45309; background: var(--color-warning-subtle); }
.module-icon-rose { color: #be123c; background: #fff1f2; }
.check-dot { display: grid; height: 1.35rem; width: 1.35rem; place-items: center; border-radius: 9999px; background: #d1fae5; color: var(--color-brand-primary); font-size: .7rem; font-weight: 900; }
.login-page { background: var(--color-bg-surface-subtle); }
.tab-strip { scrollbar-width: none; }
.tab-strip::-webkit-scrollbar { display: none; }
.tab-button { min-height: 3rem; white-space: nowrap; border-bottom: 3px solid transparent; padding: .7rem 1rem; color: var(--color-text-muted); font-size: .875rem; font-weight: 700; transition: var(--motion-duration-slow); }
.tab-button:hover { color: var(--color-brand-primary); background: var(--color-bg-surface-subtle); }
.tab-button.tab-active { border-color: var(--color-brand-primary-muted); color: var(--color-brand-primary); background: var(--color-brand-primary-subtle); }
.tab-error-count { margin-left: .4rem; display: inline-grid; min-width: 1.25rem; height: 1.25rem; place-items: center; border-radius: 9999px; background: #e11d48; padding: 0 .3rem; color: #fff; font-size: .65rem; font-weight: 900; }
.choice-card { display: flex; min-height: 5rem; flex-direction: column; align-items: flex-start; justify-content: center; border: 1px solid var(--color-border-default); border-radius: .9rem; background: var(--color-bg-surface); padding: 1rem; text-align: left; transition: var(--motion-duration-slow); }
.choice-card strong { color: var(--color-text-secondary); font-size: .875rem; }
.choice-card span { margin-top: .25rem; color: var(--color-text-muted); font-size: .75rem; }
.choice-card:hover { border-color: #6ee7b7; background: #f0fdf4; }
.choice-card-active { border-color: var(--color-brand-primary-muted); background: var(--color-brand-primary-subtle); box-shadow: 0 0 0 3px rgba(16, 185, 129, .08); }
.section-heading { display: flex; align-items: center; gap: .9rem; }
.section-heading h2 { color: var(--color-text-primary); font-size: 1.1rem; font-weight: 800; }
.section-heading p { margin-top: .15rem; color: var(--color-text-muted); font-size: .85rem; }
.section-number { display: grid; height: 2.5rem; width: 2.5rem; flex: none; place-items: center; border-radius: var(--radius-lg); background: var(--color-brand-primary-subtle); color: var(--color-brand-primary); font-size: .75rem; font-weight: 900; }
.subsection-title { margin-bottom: 1rem; border-bottom: 1px solid var(--color-border-default); padding-bottom: .65rem; font-size: .85rem; font-weight: 800; color: var(--color-text-secondary); }
.repeated-card { box-shadow: var(--shadow-xs); }
.repeated-card:focus-within { border-color: var(--color-brand-primary-muted); box-shadow: 0 0 0 3px rgba(16, 185, 129, .08); }

.socios-form-blocks, .contact-groups { display: grid; gap: 1.25rem; margin-top: 1.5rem; }
.socios-form-block { overflow: hidden; border: 1px solid var(--color-border-default); border-radius: 1rem; background: #fff; padding: 1.25rem; box-shadow: 0 4px 14px rgba(15, 23, 42, .04); }
.socios-form-block-personal { border-top: 3px solid #0f766e; background: linear-gradient(180deg, #f0fdfa 0, #fff 5rem); }
.socios-form-block-member { border-top: 3px solid #0369a1; background: linear-gradient(180deg, #f0f9ff 0, #fff 5rem); }
.socios-form-block-header, .contact-group-header { display: flex; align-items: center; gap: .8rem; margin: -.25rem 0 1.25rem; padding-bottom: .9rem; border-bottom: 1px solid var(--color-border-default); }
.socios-form-block-header h3, .contact-group-header h3 { color: var(--color-text-primary); font-size: .95rem; font-weight: 800; }
.socios-form-block-header p, .contact-group-header p { margin-top: .15rem; color: var(--color-text-muted); font-size: .75rem; }
.socios-form-block-icon, .contact-group-icon { display: grid; width: 2.25rem; height: 2.25rem; flex: none; place-items: center; border-radius: .7rem; background: #ccfbf1; color: #115e59; font-size: .68rem; font-weight: 900; letter-spacing: .03em; }
.socios-form-block-member .socios-form-block-icon { background: #dbeafe; color: #075985; }
.contact-group { border: 1px solid var(--color-border-default); border-radius: 1rem; background: #f8fafc; padding: 1.25rem; }
.contact-group-email { border-left: 4px solid #0d9488; }
.contact-group-phone { border-left: 4px solid #0284c7; }
.contact-group-header { margin-top: 0; }
.contact-group-phone .contact-group-icon { background: #e0f2fe; color: #0369a1; }
.contact-record-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.contact-record-card { min-width: 0; background: #fff; }
.contact-record-number { display: inline-grid; width: 1.65rem; height: 1.65rem; margin-right: .45rem; place-items: center; border-radius: 9999px; background: var(--color-brand-primary-subtle); color: var(--color-brand-primary); font-size: .65rem; }
.reference-group { margin-top: 1.5rem; border: 1px solid var(--color-border-default); border-left: 4px solid #d97706; border-radius: 1rem; background: #fafafa; padding: 1.25rem; }
.reference-group-header { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--color-border-default); }
.reference-group-header h3 { color: var(--color-text-primary); font-size: .95rem; font-weight: 800; }
.reference-group-header p { margin-top: .15rem; color: var(--color-text-muted); font-size: .75rem; }
.reference-group-icon { display: grid; width: 2.25rem; height: 2.25rem; flex: none; place-items: center; border-radius: .7rem; background: #fef3c7; color: #92400e; font-size: .68rem; font-weight: 900; }
.reference-group-hint { margin-left: auto; border-radius: 9999px; background: #fffbeb; padding: .35rem .65rem; color: #92400e; font-size: .68rem; font-weight: 800; }
.reference-record-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.reference-record-card { min-width: 0; background: #fff; }
.reference-record-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reference-record-fields .field-nombre, .reference-record-fields .field-observacion { grid-column: 1 / -1; }
.reference-record-fields textarea { height: 5.5rem; min-height: 5.5rem; resize: vertical; }
.reference-record-card:focus-within { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .10); }

@media (max-width: 900px) { .contact-record-list, .reference-record-list { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .socios-form-block, .contact-group, .reference-group { padding: 1rem; } .reference-group-hint { display: none; } .reference-record-fields { grid-template-columns: 1fr; } .reference-record-fields .form-field { grid-column: 1; } }
.profile-header { background: radial-gradient(circle at 90% 10%, rgba(110, 231, 183, .2), transparent 30%), linear-gradient(135deg, #064e3b, #0f766e 58%, #075985); }
.profile-avatar { display: grid; height: 4rem; width: 4rem; flex: none; place-items: center; border-radius: 1rem; background: rgba(255, 255, 255, .16); font-size: 1.2rem; font-weight: 900; letter-spacing: .05em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.avatar-small { display: grid; height: 2.5rem; width: 2.5rem; flex: none; place-items: center; border-radius: var(--radius-lg); background: #d1fae5; color: var(--color-brand-primary); font-size: .75rem; font-weight: 900; text-transform: uppercase; }
.timeline-dot { margin-top: .3rem; height: .75rem; width: .75rem; flex: none; border-radius: 9999px; background: #10b981; box-shadow: 0 0 0 4px #d1fae5; }
.detail-card { border: 1px solid var(--color-border-default); border-radius: var(--radius-xl); background: var(--color-bg-surface); padding: 1.25rem; box-shadow: var(--shadow-xs); }
.detail-card > h2 { font-size: 1rem; font-weight: 800; color: var(--color-text-primary); }
.detail-grid { margin-top: 1rem; display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-grid dt, .detail-label { display: block; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-disabled); }
.detail-grid dd { margin-top: .25rem; font-size: .9rem; font-weight: 600; color: var(--color-text-secondary); }
.summary-tile { border-radius: .8rem; background: var(--color-bg-surface-subtle); padding: 1rem; text-align: center; }
.summary-tile strong { display: block; font-size: 1.5rem; color: var(--color-brand-primary); }
.summary-tile span { font-size: .75rem; font-weight: 700; color: var(--color-text-muted); }

/* ==========================================================================
   9. Module-specific Legacy Styles
   ========================================================================== */

.parameter-group { overflow: hidden; border: 1px solid #d8e2ea; border-left: 5px solid #0f766e; border-radius: 1rem; background: #fff; box-shadow: var(--shadow-md); }
.parameter-group-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #d8e2ea; background: linear-gradient(90deg, #ecfdf5, #f8fafc); padding: 1rem 1.1rem; }
.parameter-group-header h2 { font-size: 1rem; font-weight: 900; color: var(--color-text-primary); }
.parameter-group-kicker { margin-bottom: .15rem; font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--color-brand-primary); }
.parameter-group-count { flex: none; border-radius: 9999px; background: #d1fae5; padding: .35rem .7rem; font-size: .72rem; font-weight: 900; color: var(--color-brand-primary); }
.parameter-group .data-table th { background: #fff; }
.parameter-group .data-table tbody tr:first-child td { border-top: 0; }
.parameter-group .data-table tbody tr:nth-child(even) { background: #fbfdfe; }
.registry-group { border: 1px solid var(--color-border-default); background: #fff; box-shadow: 0 4px 16px rgba(15, 23, 42, .05); }
.registry-group-header { border-left: 5px solid var(--registry-accent); background: var(--registry-header); }
.registry-group-content { border-color: var(--registry-border); background: var(--registry-surface); }
.registry-group-icon, .registry-option-icon { background: var(--registry-icon-bg); color: var(--registry-accent-dark); }
.registry-group-kicker, .registry-option-action { color: var(--registry-accent-dark); }
.registry-group-count { background: var(--registry-badge-bg); color: var(--registry-accent-dark); }
.registry-option-card { border-color: var(--registry-border); }
.registry-option-card:hover { border-color: var(--registry-accent-soft); }
.registry-option-card:hover .registry-option-title { color: var(--registry-accent-dark); }
.registry-group-personas { --registry-accent: #2563eb; --registry-accent-dark: #1d4ed8; --registry-accent-soft: #60a5fa; --registry-border: #bfdbfe; --registry-header: #eff6ff; --registry-surface: #f8fbff; --registry-icon-bg: #dbeafe; --registry-badge-bg: #dbeafe; }
.registry-group-finanzas { --registry-accent: #d97706; --registry-accent-dark: #b45309; --registry-accent-soft: #f59e0b; --registry-border: #fde68a; --registry-header: #fffbeb; --registry-surface: #fffdf7; --registry-icon-bg: #fef3c7; --registry-badge-bg: #fef3c7; }
.registry-group-administracion { --registry-accent: #e11d48; --registry-accent-dark: #be123c; --registry-accent-soft: #fb7185; --registry-border: #fecdd3; --registry-header: #fff1f2; --registry-surface: #fffafa; --registry-icon-bg: #ffe4e6; --registry-badge-bg: #ffe4e6; }
.admin-shortcut { display: flex; min-height: 5rem; align-items: center; gap: .85rem; border: 1px solid var(--admin-border); border-radius: 1rem; background: var(--admin-bg); padding: 1rem; color: var(--admin-text); transition: var(--motion-duration-slow); }
.admin-shortcut:hover { transform: translateY(-1px); border-color: var(--admin-hover); box-shadow: 0 10px 22px rgba(15, 23, 42, .07); }
.admin-shortcut-icon { display: grid; height: 2.75rem; width: 2.75rem; flex: none; place-items: center; border-radius: .8rem; background: var(--admin-icon-bg); font-size: .78rem; font-weight: 900; color: var(--admin-text); }
.admin-shortcut strong { display: block; font-size: .9rem; color: var(--color-text-primary); }
.admin-shortcut small { margin-top: .15rem; display: block; font-size: .74rem; color: var(--color-text-muted); }
.admin-shortcut-emerald { --admin-border: #a7f3d0; --admin-hover: #34d399; --admin-bg: #f0fdf4; --admin-icon-bg: #d1fae5; --admin-text: #047857; }
.admin-shortcut-indigo { --admin-border: #c7d2fe; --admin-hover: #818cf8; --admin-bg: #eef2ff; --admin-icon-bg: #e0e7ff; --admin-text: #4338ca; }
.admin-shortcut-cyan { --admin-border: #a5f3fc; --admin-hover: #22d3ee; --admin-bg: #ecfeff; --admin-icon-bg: #cffafe; --admin-text: #0e7490; }
.admin-shortcut-blue { --admin-border: #bfdbfe; --admin-hover: #60a5fa; --admin-bg: #eff6ff; --admin-icon-bg: #dbeafe; --admin-text: #1d4ed8; }
.admin-shortcut-amber { --admin-border: #fde68a; --admin-hover: #f59e0b; --admin-bg: #fffbeb; --admin-icon-bg: #fef3c7; --admin-text: #b45309; }

/* Account plan tree */
.account-structure-stat {
  display: flex;
  min-height: 6.25rem;
  align-items: center;
  gap: 1rem;
  border: 1px solid #dbe5ea;
  border-radius: 1rem;
  background: #fff;
  padding: 1rem;
  box-shadow: 0 3px 12px rgba(15, 23, 42, .045);
}
.account-structure-stat strong { margin-top: .25rem; display: block; color: #0f172a; font-size: 1.45rem; line-height: 1.15; }
.account-structure-stat-icon { display: grid; height: 2.75rem; width: 2.75rem; flex: none; place-items: center; border-radius: .85rem; background: #f1f5f9; color: #475569; font-size: .72rem; font-weight: 900; }
.account-structure-stat-primary { border-color: #a7f3d0; background: linear-gradient(135deg, #ecfdf5, #fff 75%); }
.account-structure-stat-primary strong { color: #047857; }
.account-structure-stat-primary .account-structure-stat-icon { background: #d1fae5; color: #047857; }
.account-structure-stat-danger { border-color: #fecdd3; background: linear-gradient(135deg, #fff1f2, #fff 75%); }
.account-structure-stat-danger strong { color: #be123c; }
.account-structure-stat-danger .account-structure-stat-icon { background: #ffe4e6; color: #be123c; }
.account-tree-link {
  color: var(--color-text-primary);
  font-weight: 800;
  text-decoration: none;
}
.account-tree-link:hover { color: var(--color-brand-primary); text-decoration: underline; text-underline-offset: 3px; }

/* Hierarchical chart of accounts browser */
.plan-account-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.plan-account-stat { display: flex; min-height: 5.25rem; align-items: center; gap: .9rem; border: 1px solid #dbe5ea; border-radius: 1rem; background: #fff; padding: .9rem 1rem; box-shadow: 0 4px 14px rgba(15, 23, 42, .04); }
.plan-account-stat strong { display: block; margin-top: .2rem; color: #0f172a; font-size: 1.45rem; line-height: 1; }
.plan-account-stat-icon { display: grid; height: 2.55rem; width: 2.55rem; flex: none; place-items: center; border-radius: .8rem; background: #f1f5f9; color: #475569; font-size: .7rem; font-weight: 900; }
.plan-account-stat-primary { border-color: #a7f3d0; background: linear-gradient(125deg, #ecfdf5, #fff 78%); }
.plan-account-stat-primary strong { color: #047857; }
.plan-account-stat-primary .plan-account-stat-icon { background: #d1fae5; color: #047857; }
.plan-account-shell { box-shadow: 0 12px 30px rgba(15, 23, 42, .055); }
.plan-account-browser-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #d8e8e2; background: linear-gradient(110deg, #f0fdf4, #fff 65%); padding: 1.15rem 1.25rem; }
.plan-account-browser-header h2 { margin-top: .15rem; color: #0f172a; font-size: 1rem; font-weight: 900; }
.plan-account-browser-header p:last-child { margin-top: .25rem; color: #64748b; font-size: .75rem; }
.plan-account-view-switch { display: inline-flex; flex: none; gap: .2rem; border: 1px solid #cbd5e1; border-radius: .75rem; background: #fff; padding: .22rem; }
.plan-account-view-switch button { border-radius: .55rem; padding: .55rem .8rem; color: #64748b; font-size: .75rem; font-weight: 800; }
.plan-account-view-switch button:hover { color: #047857; }
.plan-account-view-switch button.is-active { background: #047857; box-shadow: 0 3px 8px rgba(4, 120, 87, .18); color: #fff; }
.plan-account-filters { display: grid; grid-template-columns: minmax(16rem, 1fr) minmax(11rem, 14rem) minmax(11rem, 14rem) auto; align-items: end; gap: .8rem; border-bottom: 1px solid #e2e8f0; padding: 1rem 1.25rem; }
.plan-account-filters label { font-size: .72rem; }
.plan-account-filter-actions { display: flex; gap: .5rem; }
.plan-account-results-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #e2e8f0; background: #fbfdfc; padding: .75rem 1.25rem; }
.plan-account-results-header strong { color: #0f172a; font-size: .82rem; }
.plan-account-results-header p { margin-top: .18rem; color: #64748b; font-size: .7rem; }
.plan-account-tree-actions { display: flex; align-items: center; gap: .5rem; }
.plan-account-level { min-width: 7rem; border: 1px solid #dbe5ea; border-radius: 9999px; background: #fff; padding: .42rem .75rem; color: #64748b; text-align: center; font-size: .7rem; }
.plan-account-table-scroll { max-height: 68vh; overflow: auto; }
.plan-account-table thead { position: sticky; top: 0; z-index: 4; box-shadow: 0 1px 0 #dbe5ea; }
.plan-account-table th:first-child { width: 52%; }
.plan-account-row { transition: background-color .15s ease, box-shadow .15s ease; }
.plan-account-row:hover { background: #f8fcfa; box-shadow: inset 3px 0 #6ee7b7; }
.plan-account-row-match { background: #ecfdf5; box-shadow: inset 3px 0 #10b981; }
.plan-account-identity { display: flex; align-items: center; gap: .65rem; min-width: 19rem; padding-left: var(--plan-indent); transition: padding-left .2s ease; }
.plan-account-branch-toggle { display: grid; height: 1.8rem; width: 1.8rem; flex: none; place-items: center; border: 1px solid #a7f3d0; border-radius: .55rem; background: #ecfdf5; color: #047857; font-size: 1rem; font-weight: 900; line-height: 1; transition: background-color .15s ease, border-color .15s ease, transform .15s ease; }
.plan-account-branch-toggle:hover { transform: scale(1.04); border-color: #34d399; background: #d1fae5; }
.plan-account-leaf { position: relative; height: 1.8rem; width: 1.8rem; flex: none; }
.plan-account-leaf::before { content: ""; position: absolute; left: .72rem; top: .67rem; height: .42rem; width: .42rem; border-radius: 9999px; background: #94a3b8; box-shadow: 0 0 0 4px #f1f5f9; }
.plan-account-main-link { min-width: 0; color: #0f172a; text-decoration: none; }
.plan-account-main-link:hover strong { color: #047857; text-decoration: underline; text-underline-offset: 3px; }
.plan-account-code { display: block; margin-bottom: .14rem; color: #047857; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .68rem; font-weight: 900; letter-spacing: .025em; }
.plan-account-main-link strong { display: block; font-size: .82rem; line-height: 1.25; }
.plan-account-main-link small { display: block; overflow: hidden; margin-top: .2rem; color: #94a3b8; font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.plan-account-nature { color: #475569; font-size: .75rem; font-weight: 700; }
.plan-account-structure-action { display: inline-flex; align-items: center; justify-content: flex-end; gap: .35rem; color: #047857; font-size: .7rem; font-weight: 900; text-decoration: none; }
.plan-account-structure-action:hover { color: #065f46; text-decoration: underline; text-underline-offset: 3px; }

/* Accounting automation governance */
.accounting-coverage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.accounting-coverage-card { overflow: hidden; border: 1px solid #dbe5ea; border-radius: 1rem; background: #fff; padding: 1rem; box-shadow: 0 5px 16px rgba(15, 23, 42, .045); }
.accounting-coverage-heading { display: flex; align-items: center; gap: .7rem; }
.accounting-coverage-heading > span { display: grid; height: 2.45rem; width: 2.45rem; flex: none; place-items: center; border-radius: .75rem; background: #f1f5f9; color: #475569; font-size: .66rem; font-weight: 900; }
.accounting-coverage-heading h2 { color: #0f172a; font-size: .86rem; font-weight: 900; }
.accounting-coverage-heading p { margin-top: .1rem; color: #94a3b8; font-size: .63rem; }
.accounting-coverage-progress { overflow: hidden; height: .42rem; margin-top: 1rem; border-radius: 9999px; background: #e2e8f0; }
.accounting-coverage-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #10b981, #14b8a6); }
.accounting-coverage-numbers { display: flex; justify-content: space-between; gap: .5rem; margin-top: .55rem; font-size: .68rem; }
.accounting-coverage-numbers strong { color: #334155; }
.accounting-coverage-numbers span { color: #64748b; }
.accounting-coverage-card footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem; margin: .9rem -1rem -1rem; border-top: 1px solid #edf2f4; background: #f8fafc; padding: .65rem 1rem; color: #64748b; font-size: .62rem; font-weight: 700; }
.accounting-coverage-card footer b { color: #b45309; }
.accounting-coverage-complete { border-color: #a7f3d0; background: linear-gradient(135deg, #ecfdf5, #fff 70%); }
.accounting-coverage-complete .accounting-coverage-heading > span { background: #d1fae5; color: #047857; }
.accounting-coverage-future { border-style: dashed; background: linear-gradient(135deg, #f8fafc, #fff); }
.accounting-coverage-future-label { margin-top: 1rem; border: 1px dashed #cbd5e1; border-radius: .7rem; padding: .55rem; color: #64748b; text-align: center; font-size: .68rem; font-weight: 800; }
.accounting-rules-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #e2e8f0; background: #fbfdfc; padding: .8rem 1rem; }
.accounting-rules-header strong { color: #0f172a; font-size: .8rem; }
.accounting-rules-header p { margin-top: .15rem; color: #64748b; font-size: .68rem; }
.accounting-rules-legend { display: flex; flex-wrap: wrap; gap: .8rem; color: #64748b; font-size: .68rem; font-weight: 700; }
.accounting-rules-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.form-section-header { display: flex; align-items: center; gap: .8rem; border-bottom: 1px solid #dbe5ea; background: linear-gradient(110deg, #f0fdf4, #fff 72%); padding: 1rem 1.25rem; }
.form-section-header h2 { color: #0f172a; font-size: .92rem; font-weight: 900; }
.form-section-header p { margin-top: .15rem; color: #64748b; font-size: .7rem; }
.form-section-number { display: grid; height: 2.5rem; width: 2.5rem; flex: none; place-items: center; border: 1px solid #a7f3d0; border-radius: .75rem; background: #dcfce7; color: #047857; font-size: .7rem; font-weight: 900; }
.status-dot { display: block; height: .45rem; width: .45rem; border-radius: 9999px; }
.status-dot-success { background: #10b981; }
.status-dot-warning { background: #f59e0b; }
.accounting-rule-code { color: #047857; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .7rem; font-weight: 900; }
.accounting-simulator-safety { display: flex; align-items: center; gap: .8rem; border: 1px solid #a7f3d0; border-radius: 1rem; background: linear-gradient(110deg, #ecfdf5, #fff 72%); padding: .9rem 1rem; }
.accounting-simulator-safety > span { display: grid; height: 2.4rem; width: 2.4rem; flex: none; place-items: center; border-radius: .75rem; background: #d1fae5; color: #047857; font-weight: 900; }
.accounting-simulator-safety div { min-width: 0; flex: 1; }
.accounting-simulator-safety strong { color: #064e3b; font-size: .8rem; }
.accounting-simulator-safety p { margin-top: .12rem; color: #64748b; font-size: .68rem; }
.accounting-simulator-safety > b { border-radius: 9999px; background: #fff; padding: .35rem .65rem; color: #047857; font-size: .65rem; }
.accounting-simulator-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem); align-items: start; gap: 1rem; }
.accounting-simulator-submit { display: flex; justify-content: flex-end; border-top: 1px solid #e2e8f0; background: #f8fafc; padding: .85rem 1rem; }
.accounting-simulator-contract { border: 1px solid #cbded7; border-radius: 1rem; background: #fff; padding: 1.1rem; box-shadow: 0 8px 22px rgba(15, 23, 42, .05); }
.accounting-simulator-contract h2 { margin-top: .2rem; color: #047857; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .9rem; font-weight: 900; }
.accounting-simulator-contract > strong { display: block; margin-top: .35rem; color: #334155; font-size: .72rem; }
.accounting-simulator-contract > p:last-of-type { margin-top: .75rem; color: #64748b; font-size: .7rem; line-height: 1.45; }
.accounting-simulator-contract dl { margin-top: 1rem; border-top: 1px solid #e2e8f0; }
.accounting-simulator-contract dl div { display: flex; justify-content: space-between; gap: .7rem; border-bottom: 1px solid #edf2f4; padding: .65rem 0; font-size: .68rem; }
.accounting-simulator-contract dt { color: #94a3b8; }
.accounting-simulator-contract dd { color: #334155; text-align: right; font-weight: 800; }
.accounting-simulation-result { overflow: hidden; border: 1px solid #cbded7; border-radius: 1rem; background: #fff; box-shadow: 0 10px 26px rgba(15, 23, 42, .055); }
.accounting-simulation-result > header { display: flex; align-items: center; gap: .8rem; border-bottom: 1px solid #dbe5ea; padding: 1rem 1.15rem; }
.accounting-simulation-result > header > span { display: grid; height: 2.5rem; width: 2.5rem; flex: none; place-items: center; border-radius: .75rem; font-weight: 900; }
.accounting-simulation-result > header div { min-width: 0; flex: 1; }
.accounting-simulation-result > header h2 { margin-top: .12rem; color: #0f172a; font-size: .95rem; font-weight: 900; }
.accounting-simulation-result > header > b { border-radius: 9999px; padding: .35rem .65rem; font-size: .65rem; }
.accounting-simulation-result > footer { border-top: 1px solid #e2e8f0; background: #f8fafc; padding: .75rem 1.15rem; color: #64748b; font-size: .68rem; font-weight: 700; }
.accounting-simulation-result-ok { border-color: #86efac; }
.accounting-simulation-result-ok > header { background: linear-gradient(110deg, #ecfdf5, #fff 72%); }
.accounting-simulation-result-ok > header > span { background: #d1fae5; color: #047857; }
.accounting-simulation-result-ok > header > b { background: #d1fae5; color: #047857; }
.accounting-simulation-result-error { border-color: #fecdd3; }
.accounting-simulation-result-error > header { background: linear-gradient(110deg, #fff1f2, #fff 72%); }
.accounting-simulation-result-error > header > span { background: #ffe4e6; color: #be123c; }
.accounting-simulation-result-error > ul, .accounting-simulation-result-error > p { margin: 1rem 1.15rem; border-radius: .75rem; background: #fff1f2; padding: .8rem 1rem; color: #9f1239; font-size: .72rem; }
.accounting-simulation-result-error > ul { padding-left: 2rem; list-style: disc; }
.accounting-simulation-sources { padding: 1rem 1.15rem; }
.accounting-simulation-sources h3 { margin-bottom: .65rem; color: #334155; font-size: .78rem; font-weight: 900; }
.accounting-simulation-sources article { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .7rem; border: 1px solid #e2e8f0; border-radius: .75rem; padding: .65rem .75rem; }
.accounting-simulation-sources article + article { margin-top: .5rem; }
.accounting-simulation-sources article > span { display: grid; height: 2rem; width: 2rem; place-items: center; border-radius: .6rem; background: #ecfdf5; color: #047857; font-size: .65rem; font-weight: 900; }
.accounting-simulation-sources small, .accounting-simulation-sources strong, .accounting-simulation-sources p { display: block; }
.accounting-simulation-sources small { color: #047857; font-size: .6rem; font-weight: 800; text-transform: uppercase; }
.accounting-simulation-sources strong { margin-top: .1rem; color: #0f172a; font-size: .75rem; }
.accounting-simulation-sources p { margin-top: .12rem; color: #64748b; font-size: .68rem; }
.accounting-simulation-entry { border-top: 1px solid #e2e8f0; }
.accounting-simulation-entry-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.15rem; }
.accounting-simulation-entry-heading h3 { margin-top: .1rem; color: #0f172a; font-size: .85rem; font-weight: 900; }
.accounting-simulation-entry-heading > span { color: #047857; font-size: .85rem; font-weight: 900; }
.accounting-template-picker { overflow: hidden; border: 1px solid #cbded7; border-radius: 1rem; background: #fff; box-shadow: 0 10px 26px rgba(15, 23, 42, .055); }
.accounting-template-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #dbe5ea; background: linear-gradient(110deg, #ecfdf5, #fff 70%); padding: 1.1rem 1.25rem; }
.accounting-template-picker-heading h2 { margin-top: .12rem; color: #0f172a; font-size: 1rem; font-weight: 900; }
.accounting-template-picker-heading p:last-child { margin-top: .2rem; color: #64748b; font-size: .72rem; }
.accounting-template-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; padding: 1rem; }
.accounting-template-option { position: relative; display: grid; min-height: 5.2rem; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .8rem; border: 1px solid #dbe5ea; border-radius: .85rem; background: #fff; padding: .8rem .9rem; color: #334155; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.accounting-template-option:hover { transform: translateY(-1px); border-color: #6ee7b7; box-shadow: 0 7px 17px rgba(15, 23, 42, .07); }
.accounting-template-option > span { display: grid; height: 2.5rem; width: 2.5rem; place-items: center; border-radius: .75rem; background: #f1f5f9; color: #475569; font-size: .64rem; font-weight: 900; }
.accounting-template-option strong, .accounting-template-option small { display: block; }
.accounting-template-option strong { color: #0f172a; font-size: .8rem; font-weight: 900; }
.accounting-template-option small { margin-top: .2rem; color: #64748b; font-size: .66rem; line-height: 1.35; }
.accounting-template-option > b { position: absolute; right: .7rem; top: .55rem; border-radius: 9999px; background: #d1fae5; padding: .25rem .5rem; color: #047857; font-size: .58rem; }
.accounting-template-option.is-selected { border-color: #34d399; background: linear-gradient(120deg, #ecfdf5, #fff); box-shadow: 0 0 0 3px rgba(16, 185, 129, .08); }
.accounting-template-option.is-selected > span { background: #047857; color: #fff; }
.accounting-guided-summary { display: flex; align-items: center; gap: .9rem; border: 1px solid #a7f3d0; border-radius: 1rem; background: linear-gradient(110deg, #ecfdf5, #fff 75%); padding: 1rem 1.15rem; }
.accounting-guided-summary > span { display: grid; height: 2.7rem; width: 2.7rem; flex: none; place-items: center; border-radius: .8rem; background: #d1fae5; color: #047857; font-size: .7rem; font-weight: 900; }
.accounting-guided-summary strong { color: #064e3b; font-size: .9rem; }
.accounting-guided-summary p { margin-top: .15rem; color: #334155; font-size: .75rem; }
.accounting-guided-summary small { display: block; margin-top: .3rem; color: #64748b; font-size: .67rem; }
.accounting-guided-editor:not(.show-advanced) .rule-field-codigo,
.accounting-guided-editor:not(.show-advanced) .rule-field-modulo,
.accounting-guided-editor:not(.show-advanced) .rule-field-evento,
.accounting-guided-editor:not(.show-advanced) .rule-field-prioridad,
.accounting-guided-editor:not(.show-advanced) .rule-field-version,
.accounting-guided-editor:not(.show-advanced) .accounting-line-field-orden,
.accounting-guided-editor:not(.show-advanced) .accounting-line-field-componente,
.accounting-guided-editor:not(.show-advanced) .accounting-line-field-porcentaje,
.accounting-guided-editor:not(.show-advanced) .accounting-line-field-concepto_plantilla,
.accounting-guided-editor:not(.show-advanced) .accounting-line-delete { display: none; }
.accounting-guided-editor:not(.show-advanced) .accounting-line-field-lado { grid-column: span 3; }
.accounting-guided-editor:not(.show-advanced) .accounting-line-field-origen_cuenta { grid-column: span 4; }
.accounting-guided-editor:not(.show-advanced) .accounting-line-field-plan_cuenta { grid-column: span 5; }
.accounting-rule-explanation { border-color: #a7f3d0; box-shadow: 0 12px 28px rgba(5, 150, 105, .07); }
.accounting-explanation-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #bbf7d0; background: linear-gradient(110deg, #ecfdf5, #fff 72%); padding: 1.2rem 1.3rem; }
.accounting-explanation-header h2 { margin-top: .18rem; color: #064e3b; font-size: 1.05rem; font-weight: 900; }
.accounting-explanation-header p:last-child { margin-top: .3rem; max-width: 48rem; color: #64748b; font-size: .73rem; }
.accounting-flow-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; padding: 1.15rem; }
.accounting-flow-side { position: relative; display: grid; min-height: 6rem; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .8rem; border: 1px solid #dbe5ea; border-radius: .9rem; background: #fff; padding: .9rem; }
.accounting-flow-side-label { display: grid; height: 2.65rem; min-width: 2.65rem; place-items: center; border-radius: .75rem; padding: 0 .45rem; background: #f1f5f9; color: #475569; font-size: .65rem; font-weight: 900; text-transform: uppercase; }
.accounting-flow-debe { border-left: 4px solid #10b981; }
.accounting-flow-debe .accounting-flow-side-label { background: #d1fae5; color: #047857; }
.accounting-flow-haber { border-left: 4px solid #0ea5e9; }
.accounting-flow-haber .accounting-flow-side-label { background: #e0f2fe; color: #0369a1; }
.accounting-flow-side strong { display: block; color: #0f172a; font-size: .82rem; }
.accounting-flow-side p { margin-top: .2rem; color: #475569; font-size: .72rem; }
.accounting-flow-side small { display: block; margin-top: .28rem; color: #94a3b8; font-size: .63rem; }
.accounting-explanation-footer { border-top: 1px solid #e2e8f0; background: #f8fafc; padding: .75rem 1.25rem; color: #475569; font-size: .7rem; font-weight: 700; }
.accounting-technical-details { overflow: hidden; border: 1px solid #dbe5ea; border-radius: .9rem; background: #fff; }
.accounting-technical-details summary { cursor: pointer; padding: .85rem 1rem; color: #475569; font-size: .73rem; font-weight: 900; }
.accounting-technical-details[open] summary { border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.accounting-rule-metadata { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: .5rem 1rem 1rem; }
.accounting-rule-metadata > div { padding: .7rem; }
.accounting-rule-metadata dt { color: #94a3b8; font-size: .62rem; font-weight: 800; text-transform: uppercase; }
.accounting-rule-metadata dd { margin-top: .2rem; color: #334155; font-size: .75rem; font-weight: 800; }
.accounting-lines-heading { display: flex; align-items: center; }
.accounting-rule-line { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .65rem 1rem; border: 1px solid #dbe5ea; border-radius: 1rem; background: #fbfdfc; padding: 1rem; }
.accounting-rule-line-error { border-color: #fda4af; background: #fff7f7; }
.accounting-rule-line-number { display: grid; height: 3.25rem; width: 3.25rem; place-items: center; align-content: center; border: 1px solid #a7f3d0; border-radius: .85rem; background: #ecfdf5; color: #047857; }
.accounting-rule-line-number span { font-size: 1rem; font-weight: 900; line-height: 1; }
.accounting-rule-line-number small { margin-top: .2rem; font-size: .55rem; font-weight: 800; text-transform: uppercase; }
.accounting-rule-line-fields { display: grid; grid-column: 2; grid-row: 1 / span 2; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .75rem; }
.accounting-line-field-orden { grid-column: span 1; }
.accounting-line-field-lado { grid-column: span 2; }
.accounting-line-field-componente { grid-column: span 2; }
.accounting-line-field-origen_cuenta { grid-column: span 3; }
.accounting-line-field-plan_cuenta { grid-column: span 3; }
.accounting-line-field-porcentaje { grid-column: span 1; }
.accounting-line-field-concepto_plantilla { grid-column: 1 / -1; }
.accounting-line-delete { grid-column: 1; grid-row: 2; }
.accounting-line-concept { grid-column: 1 / -1; }
.accounting-line-delete { display: flex; align-items: center; gap: .35rem; padding-top: 1.8rem; color: #be123c; font-size: .68rem; font-weight: 800; }
.accounting-line-wide-error { grid-column: 1 / -1; }
.accounting-rule-diagnostic { overflow: hidden; border: 1px solid #cbded7; border-radius: 1rem; background: #fff; box-shadow: 0 8px 22px rgba(15, 23, 42, .05); }
.accounting-rule-diagnostic-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #dbe5ea; background: linear-gradient(110deg, #f0fdf4, #fff 72%); padding: 1rem 1.15rem; }
.accounting-rule-diagnostic-heading h2 { margin-top: .1rem; color: #0f172a; font-size: .95rem; font-weight: 900; }
.accounting-diagnostic-list { margin: .9rem 1.15rem; border-radius: .75rem; padding: .75rem 1rem .75rem 2rem; font-size: .75rem; }
.accounting-diagnostic-list li + li { margin-top: .3rem; }
.accounting-diagnostic-errors { border: 1px solid #fecdd3; background: #fff1f2; color: #9f1239; list-style: disc; }
.accounting-diagnostic-warnings { border: 1px solid #fde68a; background: #fffbeb; color: #92400e; list-style: disc; }
.accounting-rule-diagnostic footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; border-top: 1px solid #e2e8f0; background: #f8fafc; padding: .8rem 1.15rem; }
.account-tree-panel { border-color: #cfe3dc; box-shadow: 0 14px 35px rgba(15, 23, 42, .07); }
.account-tree-panel-header { border-bottom: 1px solid #d8e8e2; background: linear-gradient(110deg, #f0fdf4, #fff 62%, #f0fdfa); }
.account-tree-canvas { background-color: #f8fbfa; background-image: radial-gradient(circle, rgba(15, 118, 110, .09) 1px, transparent 1px); background-size: 22px 22px; }
.account-tree { position: relative; margin: 0; padding: .25rem 0; list-style: none; }
.account-tree-item { position: relative; width: min(100%, 52rem); margin-inline: auto; padding: 0 0 1.4rem 4rem; }
.account-tree-item:last-child { padding-bottom: 0; }
.account-tree-item::before {
  content: "";
  position: absolute;
  left: 1.3rem;
  top: 2.15rem;
  bottom: -.25rem;
  width: 3px;
  border-radius: 9999px;
  background: linear-gradient(#34d399, #99f6e4);
}
.account-tree-item:last-child::before { display: none; }
.account-tree-marker {
  position: absolute;
  left: 0;
  top: .7rem;
  z-index: 1;
  display: grid;
  height: 2.6rem;
  width: 2.6rem;
  place-items: center;
  border: 2px solid #a7f3d0;
  border-radius: 9999px;
  background: #ecfdf5;
  box-shadow: 0 0 0 6px #f8fbfa, 0 5px 12px rgba(5, 150, 105, .14);
  color: #047857;
  font-size: .7rem;
  font-weight: 900;
}
.account-tree-node {
  position: relative;
  overflow: hidden;
  display: block;
  border: 1px solid #d5e3df;
  border-left: 4px solid #94a3b8;
  border-radius: 1rem;
  background: #fff;
  padding: 1rem 1.2rem 1.05rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .055);
  transition: border-color var(--motion-duration-slow), box-shadow var(--motion-duration-slow), transform var(--motion-duration-slow);
}
a.account-tree-node:hover { transform: translateX(4px); border-color: #6ee7b7; border-left-color: #10b981; box-shadow: 0 10px 24px rgba(15, 23, 42, .09); }
.account-tree-node-selected {
  border: 2px solid #10b981;
  border-left: 6px solid #059669;
  background: linear-gradient(135deg, #dff9ed, #fff 62%);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .1), 0 14px 28px rgba(5, 150, 105, .11);
}
.account-tree-item-selected .account-tree-marker { border-color: #059669; background: #059669; color: #fff; }
.account-tree-node-context { margin-bottom: .55rem; color: #64748b; font-size: .65rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.account-tree-node-selected .account-tree-node-context { color: #047857; }
.account-tree-node-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem; }
.account-tree-code { color: #047857; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .84rem; font-weight: 900; letter-spacing: .02em; }
.account-tree-name { display: block; margin-top: .4rem; color: #0f172a; font-size: 1rem; }
.account-tree-meta { margin-top: .55rem; display: flex; flex-wrap: wrap; gap: .4rem .9rem; color: #64748b; font-size: .74rem; font-weight: 700; }
.account-tree-meta span:not(:last-child)::after { content: "\00b7"; margin-left: .9rem; color: #cbd5e1; }
.account-descendants { overflow-x: auto; padding: .15rem .1rem .35rem; }
.account-descendant-node {
  position: relative;
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) minmax(14rem, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-width: 38rem;
  margin-bottom: .55rem;
  margin-left: var(--account-depth);
  border: 1px solid #dbe5ea;
  border-radius: .85rem;
  background: #fff;
  padding: .8rem 1rem;
  transition: border-color var(--motion-duration-slow), box-shadow var(--motion-duration-slow), transform var(--motion-duration-slow);
}
.account-descendant-node:hover { transform: translateX(2px); border-color: #6ee7b7; box-shadow: 0 5px 14px rgba(15, 23, 42, .06); }
.account-descendant-branch { position: absolute; left: -1.15rem; top: 50%; width: 1.15rem; height: 1px; background: #6ee7b7; }
.account-descendant-name { color: #334155; font-size: .875rem; font-weight: 700; }
.ledger-account-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid #a7f3d0; border-radius: 1rem; background: linear-gradient(120deg, #ecfdf5, #fff 72%); padding: 1.2rem 1.35rem; box-shadow: 0 8px 22px rgba(5, 150, 105, .07); }
.ledger-account-header h2 { margin-top: .2rem; color: #064e3b; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 1.35rem; font-weight: 900; }
.ledger-account-header p:last-child { margin-top: .2rem; color: #334155; font-size: .9rem; font-weight: 700; }
.ledger-back-button { gap: .45rem; }
.ledger-back-button span { font-size: 1rem; line-height: 1; }
.ledger-balance { color: #047857; font-weight: 900; }
.ledger-balance-negative { color: #be123c; }
.data-table .ledger-balance { color: #047857; }
.data-table .ledger-balance-negative { color: #be123c; }
.ledger-movements-shell { border-color: #cbded7; box-shadow: 0 10px 26px rgba(15, 23, 42, .065); }
.ledger-movements-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #dbe5ea; background: linear-gradient(110deg, #f0fdf4, #fff 65%); padding: 1.15rem 1.25rem; }
.ledger-movements-title { display: flex; min-width: 0; align-items: center; gap: .9rem; }
.ledger-movements-title h2 { margin-top: .1rem; color: #0f172a; font-size: 1.05rem; font-weight: 900; }
.ledger-movements-title p:last-child { margin-top: .2rem; color: #64748b; font-size: .76rem; }
.ledger-movements-icon { display: grid; height: 2.7rem; width: 2.7rem; flex: none; place-items: center; border-radius: .85rem; background: #d1fae5; color: #047857; font-size: .75rem; font-weight: 900; box-shadow: inset 0 0 0 1px #a7f3d0; }
.ledger-period-summary { flex: none; border: 1px solid #dbe5ea; border-radius: .8rem; background: #fff; padding: .65rem .85rem; text-align: right; }
.ledger-period-summary span { display: block; color: #64748b; font-size: .68rem; font-weight: 700; }
.ledger-period-summary strong { display: block; margin-top: .15rem; color: #0f172a; font-size: .78rem; }
.ledger-movements-table tbody tr:not(.ledger-opening-row):hover { background: #f8fffc; }
.ledger-opening-row td { border-bottom: 1px solid #bbf7d0; background: #f0fdf4; }
.ledger-opening-row td:first-child { border-left: 4px solid #10b981; }
.ledger-opening-row div { display: flex; flex-direction: column; gap: .15rem; }
.ledger-opening-row strong { color: #065f46; font-size: .8rem; }
.ledger-opening-row span { color: #64748b; font-size: .7rem; }
.ledger-entry-link { display: inline-flex; align-items: center; border-radius: .5rem; background: #ecfdf5; padding: .3rem .5rem; color: #047857; font-weight: 900; text-decoration: none; }
.ledger-entry-link:hover { background: #d1fae5; color: #065f46; }
.ledger-document { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; color: #475569; font-size: .78rem; }
.ledger-money { color: #334155; font-weight: 800; }
.ledger-money span { color: #94a3b8; font-weight: 500; }
.ledger-selector-shell { overflow: hidden; border-color: #cbded7; box-shadow: 0 12px 28px rgba(15, 23, 42, .065); }
.ledger-selector-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #dbe5ea; background: linear-gradient(110deg, #ecfdf5, #fff 68%); padding: 1.2rem 1.35rem; }
.ledger-selector-title { display: flex; min-width: 0; align-items: center; gap: 1rem; }
.ledger-selector-title h2 { margin-top: .1rem; color: #0f172a; font-size: 1.05rem; font-weight: 900; }
.ledger-selector-title p:last-child { margin-top: .25rem; color: #64748b; font-size: .76rem; }
.ledger-selector-icon { display: grid; height: 3rem; width: 3rem; flex: none; place-items: center; border: 1px solid #a7f3d0; border-radius: .9rem; background: #d1fae5; color: #047857; box-shadow: 0 5px 12px rgba(5, 150, 105, .1); }
.ledger-selector-icon svg { height: 1.35rem; width: 1.35rem; }
.ledger-selector-guide { flex: none; border: 1px solid #dbe5ea; border-radius: .85rem; background: rgba(255, 255, 255, .88); padding: .65rem .85rem; text-align: right; }
.ledger-selector-guide span { display: block; color: #065f46; font-size: .78rem; font-weight: 900; }
.ledger-selector-guide small { display: block; margin-top: .15rem; color: #64748b; font-size: .68rem; }
.ledger-selector-note { display: flex; align-items: center; gap: .6rem; border-bottom: 1px solid #e2e8f0; background: #f8fafc; padding: .65rem 1.35rem; color: #64748b; font-size: .72rem; }
.ledger-selector-note > span { display: grid; height: 1.35rem; width: 1.35rem; flex: none; place-items: center; border-radius: 9999px; background: #d1fae5; color: #047857; font-size: .7rem; font-weight: 900; }
.ledger-selector-note strong { color: #334155; }
.trial-balance-shell { border-color: #cbded7; box-shadow: 0 12px 30px rgba(15, 23, 42, .07); }
.trial-balance-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #dbe5ea; background: linear-gradient(110deg, #f0fdf4, #fff 68%); padding: 1.15rem 1.25rem; }
.trial-balance-header h2 { margin-top: .1rem; color: #0f172a; font-size: 1.05rem; font-weight: 900; }
.trial-balance-header p:last-child { margin-top: .2rem; color: #64748b; font-size: .76rem; }
.trial-balance-table thead tr:first-child th { border-bottom: 1px solid #dbe5ea; }
.trial-balance-table tbody tr:hover { background: #f8fffc; }
.trial-balance-table tbody td { font-variant-numeric: tabular-nums; }
.trial-balance-table tbody td:first-child p { margin-top: .2rem; max-width: 24rem; color: #64748b; font-size: .72rem; }
.trial-balance-code { color: #047857; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .8rem; font-weight: 900; }
.trial-balance-period { background-color: #f0fdfa !important; }
.trial-balance-closing { color: #0f172a; font-weight: 900; }
.trial-balance-table tfoot th { border-top: 2px solid #a7f3d0; background: #ecfdf5; color: #065f46; font-variant-numeric: tabular-nums; font-weight: 900; }
.trial-balance-scroll-hint { display: none; }
.financial-tabs { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.financial-tab { display: flex; min-height: 5rem; align-items: center; gap: .9rem; border: 1px solid #dbe5ea; border-radius: 1rem; background: #fff; padding: .9rem 1rem; color: #334155; box-shadow: 0 3px 12px rgba(15, 23, 42, .04); transition: var(--motion-duration-slow); }
.financial-tab:hover { transform: translateY(-1px); border-color: #6ee7b7; box-shadow: 0 9px 20px rgba(15, 23, 42, .07); }
.financial-tab-active { border-color: #34d399; background: linear-gradient(120deg, #ecfdf5, #fff); box-shadow: 0 0 0 3px rgba(16, 185, 129, .08); }
.financial-tab-icon { display: grid; height: 2.8rem; width: 2.8rem; flex: none; place-items: center; border-radius: .85rem; background: #f1f5f9; color: #475569; font-size: .7rem; font-weight: 900; }
.financial-tab-active .financial-tab-icon { background: #d1fae5; color: #047857; }
.financial-tab strong { display: block; color: #0f172a; font-size: .9rem; }
.financial-tab small { display: block; margin-top: .15rem; color: #64748b; font-size: .72rem; }
.financial-level-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid #a7f3d0; border-radius: 1rem; background: linear-gradient(110deg, #ecfdf5, #fff 72%); padding: 1rem 1.15rem; box-shadow: 0 7px 20px rgba(5, 150, 105, .06); }
.financial-level-summary { display: flex; min-width: 0; align-items: center; gap: .85rem; }
.financial-level-summary h2 { margin-top: .08rem; color: #064e3b; font-size: .9rem; font-weight: 900; }
.financial-level-summary p:last-child { margin-top: .2rem; color: #64748b; font-size: .72rem; }
.financial-level-icon { display: grid; height: 2.7rem; width: 2.7rem; flex: none; place-items: center; border-radius: .8rem; background: #d1fae5; color: #047857; font-size: .8rem; font-weight: 900; box-shadow: inset 0 0 0 1px #a7f3d0; }
.financial-level-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.financial-level-actions .btn:disabled { cursor: not-allowed; opacity: .45; }
.financial-level-badge { display: inline-flex; min-height: 2.25rem; align-items: center; gap: .25rem; border: 1px solid #a7f3d0; border-radius: .65rem; background: #fff; padding: .4rem .7rem; color: #64748b; font-size: .7rem; font-weight: 700; }
.financial-level-badge strong { color: #047857; font-size: .8rem; }
.financial-statement-grid { display: grid; align-items: start; gap: 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.financial-statement-card { overflow: hidden; border: 1px solid #cbded7; border-radius: 1rem; background: #fff; box-shadow: 0 10px 26px rgba(15, 23, 42, .06); }
.financial-statement-card > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; border-bottom: 1px solid #dbe5ea; background: linear-gradient(110deg, #f0fdf4, #fff 70%); padding: 1rem 1.15rem; }
.financial-statement-card > header h2 { margin-top: .1rem; color: #064e3b; font-size: 1.05rem; font-weight: 900; }
.financial-statement-card > header > strong { color: #047857; font-size: 1rem; }
.financial-statement-lines { padding: .45rem 0; }
.financial-statement-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; min-height: 3.2rem; border-bottom: 1px solid #edf2f4; padding: .55rem 1.1rem .55rem calc(1.1rem + var(--financial-depth)); }
.financial-statement-line:last-child { border-bottom: 0; }
.financial-statement-line:hover { background: #f8fffc; }
.financial-statement-line div { min-width: 0; }
.financial-line-account { display: flex; align-items: center; gap: .45rem; }
.financial-branch-toggle { display: grid; height: 1.45rem; width: 1.45rem; flex: none; place-items: center; border: 1px solid #a7f3d0; border-radius: .42rem; background: #ecfdf5; color: #047857; font-size: .85rem; font-weight: 900; line-height: 1; transition: var(--motion-duration-slow); }
.financial-branch-toggle:hover { border-color: #34d399; background: #d1fae5; }
.financial-branch-spacer { display: block; height: 1.45rem; width: 1.45rem; flex: none; }
.financial-statement-line div > span { display: block; color: #047857; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .68rem; font-weight: 800; }
.financial-statement-line .financial-branch-spacer { color: transparent; font-family: inherit; }
.financial-statement-line a, .financial-statement-line div > strong { display: block; margin-top: .15rem; overflow: hidden; color: #334155; font-size: .78rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.financial-statement-line a:hover { color: #047857; text-decoration: underline; text-underline-offset: 2px; }
.financial-statement-line > b { color: #0f172a; font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.financial-statement-line-group { background: #f8fafc; }
.financial-statement-line-group div > strong, .financial-statement-line-group > b { color: #0f172a; font-weight: 900; }
.financial-result-line { border-left: 4px solid #10b981; background: #ecfdf5; }
.financial-statement-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 2px solid #a7f3d0; background: #ecfdf5; padding: .85rem 1.1rem; color: #065f46; font-size: .82rem; font-weight: 900; }
.financial-empty { padding: 2rem 1rem; color: #64748b; font-size: .8rem; text-align: center; }
.financial-equation { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; border: 1px solid #a7f3d0; border-radius: 1rem; background: #ecfdf5; padding: 1rem; color: #334155; font-size: .8rem; }
.financial-equation span { display: flex; align-items: center; gap: .5rem; }
.financial-equation strong { color: #064e3b; font-size: 1rem; }
.financial-equation > b { color: #059669; font-size: 1.25rem; }
.financial-result-total { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid #6ee7b7; border-radius: 1rem; background: linear-gradient(120deg, #d1fae5, #fff); padding: 1.1rem 1.25rem; }
.financial-result-total h2 { color: #065f46; font-size: 1.05rem; font-weight: 900; }
.financial-result-total > strong { color: #047857; font-size: 1.35rem; }
.financial-result-loss { border-color: #fda4af; background: linear-gradient(120deg, #ffe4e6, #fff); }
.financial-result-loss h2, .financial-result-loss > strong { color: #be123c; }

@media (max-width: 640px) {
  .accounting-simulator-safety { align-items: flex-start; flex-wrap: wrap; }
  .accounting-simulator-safety > b { margin-left: 3.2rem; }
  .accounting-simulator-layout { grid-template-columns: 1fr; }
  .accounting-simulator-contract { order: -1; }
  .accounting-simulation-result > header { align-items: flex-start; flex-wrap: wrap; }
  .accounting-simulation-result > header > b { margin-left: 3.3rem; }
  .accounting-template-picker-heading, .accounting-explanation-header { align-items: stretch; flex-direction: column; }
  .accounting-template-options, .accounting-flow-preview, .accounting-rule-metadata { grid-template-columns: 1fr; }
  .accounting-guided-summary { align-items: flex-start; }
  .accounting-guided-editor:not(.show-advanced) .accounting-rule-line-fields > .form-field { grid-column: 1; }
  .detail-grid { grid-template-columns: 1fr; }
  .data-table th,
  .data-table td { padding: .7rem .8rem; }
  .profile-avatar { height: 3.25rem; width: 3.25rem; }
  .account-structure-stat { min-height: 5.25rem; }
  .ledger-movements-header { align-items: stretch; }
  .ledger-period-summary { width: 100%; text-align: left; }
  .ledger-selector-header { align-items: stretch; padding: 1rem; }
  .ledger-selector-title { align-items: flex-start; }
  .ledger-selector-guide { width: 100%; text-align: left; }
  .ledger-selector-note { align-items: flex-start; padding: .7rem 1rem; }
  .trial-balance-scroll-hint { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #dbe5ea; background: #f8fafc; padding: .6rem .8rem; color: #64748b; font-size: .68rem; font-weight: 700; }
  .trial-balance-scroll-hint span { color: #047857; font-size: 1rem; }
  .financial-tabs, .financial-statement-grid { grid-template-columns: 1fr; }
  .financial-level-toolbar { align-items: stretch; }
  .financial-level-summary { align-items: flex-start; }
  .financial-level-actions { width: 100%; justify-content: flex-start; }
  .financial-level-actions .btn { flex: 1 1 auto; }
  .financial-level-badge { order: -1; width: 100%; justify-content: center; }
  .financial-statement-line { padding-left: calc(.8rem + min(var(--financial-depth), 3rem)); padding-right: .8rem; }
  .financial-equation { align-items: stretch; flex-direction: column; }
  .financial-equation > b { align-self: center; }
  .account-tree-item { padding-left: 3rem; }
  .account-tree-item::before { left: 1rem; }
  .account-tree-marker { top: .8rem; height: 2rem; width: 2rem; }
  .account-tree-node { padding: .9rem; }
  .account-tree-meta span:not(:last-child)::after { display: none; }
  .account-descendant-node { margin-left: min(var(--account-depth), 3.5rem); }
  .plan-account-stats { grid-template-columns: 1fr; }
  .plan-account-stat { min-height: 4.6rem; }
  .plan-account-browser-header, .plan-account-results-header { align-items: stretch; flex-direction: column; }
  .plan-account-filters { grid-template-columns: 1fr; }
  .plan-account-filter-actions { flex-direction: column; }
  .plan-account-filter-actions .btn { width: 100%; }
  .plan-account-view-switch { align-self: stretch; }
  .plan-account-view-switch button { flex: 1; text-align: center; }
  .plan-account-tree-actions { flex-wrap: wrap; }
  .plan-account-tree-actions .btn { flex: 1; }
  .plan-account-level { order: -1; width: 100%; }
  .plan-account-table-scroll { max-height: 64vh; }
  .plan-account-identity { padding-left: min(var(--plan-indent), 4rem); }
  .accounting-coverage-grid { grid-template-columns: 1fr; }
  .accounting-rules-header, .accounting-rule-diagnostic-heading { align-items: stretch; flex-direction: column; }
  .accounting-rule-line { grid-template-columns: 1fr; }
  .accounting-rule-line-number { height: 2.6rem; width: 2.6rem; }
  .accounting-rule-line-fields { grid-column: 1; grid-row: auto; grid-template-columns: 1fr; }
  .accounting-rule-line-fields > .form-field { grid-column: 1; }
  .accounting-line-delete { grid-column: 1; grid-row: auto; padding-top: 0; }
}

@media (min-width: 641px) and (max-width: 1023px) {
  .plan-account-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-account-search { grid-column: 1 / -1; }
  .plan-account-filter-actions { justify-content: flex-end; }
  .accounting-coverage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .accounting-rule-line-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .accounting-rule-line-fields > .form-field { grid-column: span 1; }
  .accounting-rule-line-fields > .accounting-line-field-concepto_plantilla { grid-column: 1 / -1; }
}

/* Selector reutilizable para catálogos extensos. El select nativo conserva
   el valor enviado al servidor y el campo visible aporta búsqueda y teclado. */
.searchable-select { position: relative; width: 100%; }
.searchable-select-input { padding-right: 2.5rem; background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.searchable-select-input:disabled { cursor: not-allowed; background-color: #f1f5f9; color: #94a3b8; }
.searchable-select-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.searchable-select-list { position: fixed; z-index: 9999; max-height: 18rem; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #cbd5e1; border-radius: .75rem; background: #fff; padding: .3rem; box-shadow: 0 16px 36px rgba(15, 23, 42, .22); }
body > .searchable-select-list { position: fixed; right: auto; z-index: 9999; }
.searchable-select-option { display: block; width: 100%; border-radius: .5rem; padding: .65rem .75rem; text-align: left; font-size: .875rem; color: #0f172a; }
.searchable-select-option:hover, .searchable-select-option.is-active { background: #ecfdf5; color: #065f46; }
.searchable-select-empty { padding: .75rem; text-align: center; font-size: .8rem; color: #64748b; }
