@import url("https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600&display=swap");

:root {
  --color-teal: #55b2c9;
  --color-pale-blue: #cae7ee;
  --color-navy: #122c32;
  --color-light-grey: #e3e8ef;

  --bg: var(--color-light-grey);
  --surface: #ffffff;
  --surface-muted: #f4f8fa;
  --text: var(--color-navy);
  --muted: #4a6570;
  --header-bg: var(--color-navy);
  --header-text: var(--color-light-grey);
  --accent: var(--color-teal);
  --accent-hover: #449aaf;
  --accent-light: var(--color-pale-blue);
  --border: var(--color-pale-blue);
  --border-strong: #a8cdd8;
  --table-header-bg: var(--color-pale-blue);
  --table-row-hover: #eef6f8;
  --control-bg: var(--color-pale-blue);
  --danger: #b42318;
  --shadow: 0 8px 24px rgba(18, 44, 50, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Public Sans", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(85, 178, 201, 0.35);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  height: 42px;
  width: auto;
  display: block;
}

.user-name {
  color: var(--header-text);
  font-size: 0.95rem;
  font-weight: 500;
}

.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.page-intro h1 {
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text);
}

.page-intro p,
.page-subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.table-link {
  color: var(--accent);
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.table-link.table-link-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.table-link:hover {
  text-decoration: underline;
}

.modal-subtitle {
  margin: 0 0 1rem;
  color: var(--muted);
}

.modal-confirm-message {
  margin: 0 0 1.25rem;
  line-height: 1.5;
  color: var(--text);
}

.data-table-compact th,
.data-table-compact td {
  padding: 0.6rem 0.75rem;
}

.modal-dialog .modal-actions {
  margin-top: 1.25rem;
}

#cuentas-modal .table-wrap {
  max-height: min(420px, 55vh);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#cuentas-modal .data-table thead th,
#concepto-detalle-modal .data-table thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-header-bg);
}

#concepto-detalle-modal .data-table thead tr.filter-row th {
  position: sticky;
  top: 2.35rem;
  z-index: 2;
  background: var(--surface);
  padding: 0.35rem 0.4rem;
  vertical-align: middle;
}

#concepto-detalle-modal .data-table thead tr.filter-row input {
  width: 100%;
  min-width: 3rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

#concepto-detalle-modal .modal-dialog.modal-dialog-detalle {
  width: calc(100vw - 2rem);
  max-width: none;
  margin-top: 4vh;
  box-sizing: border-box;
}

#concepto-detalle-modal .modal-subtitle {
  font-size: 0.88rem;
}

#concepto-detalle-modal .concepto-detalle-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

#concepto-detalle-modal .concepto-detalle-count {
  font-size: 0.82rem;
  color: var(--muted);
}

#concepto-detalle-modal .data-table {
  width: max-content;
  min-width: 100%;
  font-size: 0.82rem;
}

#concepto-detalle-modal .data-table th,
#concepto-detalle-modal .data-table td {
  padding: 0.45rem 0.55rem;
  white-space: nowrap;
}

#concepto-detalle-modal .data-table td:nth-child(5),
#concepto-detalle-modal .data-table td:nth-child(10) {
  white-space: normal;
  min-width: 8rem;
  max-width: 18rem;
}

#concepto-detalle-modal .table-wrap {
  max-height: min(480px, 62vh);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#concepto-detalle-loading-modal {
  z-index: 2100;
}

#concepto-cuentas-modal .modal-dialog.modal-dialog-cuentas {
  width: min(760px, calc(100% - 2rem));
  margin-top: 8vh;
}

#concepto-cuentas-modal .modal-subtitle {
  font-size: 0.88rem;
}

#concepto-cuentas-modal .concepto-cuentas-search {
  margin: 0;
}

#concepto-cuentas-modal .concepto-cuentas-search input {
  min-width: 14rem;
}

#concepto-cuentas-modal .data-table thead th,
#concepto-cuentas-modal .data-table tfoot th {
  position: sticky;
  z-index: 2;
  background: var(--table-header-bg);
}

#concepto-cuentas-modal .data-table thead th {
  top: 0;
}

#concepto-cuentas-modal .data-table tfoot th {
  bottom: 0;
}

#concepto-cuentas-modal .table-wrap {
  max-height: min(480px, 62vh);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#concepto-cuentas-modal .data-table td:nth-child(2) {
  white-space: normal;
  min-width: 12rem;
}

.epigrafe-menu {
  position: fixed;
  z-index: 1900;
  min-width: 240px;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.epigrafe-menu-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.epigrafe-menu-item:hover,
.epigrafe-menu-item:focus {
  background: var(--surface-muted);
  outline: none;
}

.informe-ver-flujo .informe-ver-etiqueta.is-clickable,
.informe-ver-flujo-columnas .col-importe.is-clickable {
  cursor: pointer;
}

.modal-dialog.modal-dialog-wide {
  width: min(640px, calc(100% - 2rem));
}

.modal-dialog.modal-dialog-dual-list {
  width: min(860px, calc(100% - 2rem));
}

.dual-listbox {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dual-listbox select {
  width: 100%;
  min-height: 16rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

#excepciones-list {
  min-height: 16rem;
}

.form-field select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
}

.form-field input[type="search"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  margin-bottom: 0.5rem;
}

.field-hint {
  font-size: 0.82rem;
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.modal-dialog-tree {
  width: min(900px, calc(100% - 2rem));
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
}

.modal-dialog-tree .tree-wrap {
  flex: 1;
  overflow-y: auto;
  max-height: min(520px, 60vh);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: var(--surface-muted);
}

.tree-root,
.tree-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree-children {
  margin-left: 1.25rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

.tree-node {
  margin: 0.35rem 0;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tree-toggle {
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  background: var(--control-bg);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
  flex-shrink: 0;
}

.tree-toggle:hover {
  background: var(--border-strong);
}

.tree-toggle-spacer {
  display: inline-block;
  width: 1.5rem;
  flex-shrink: 0;
}

.tree-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.tree-cuentas-section {
  margin: 0.35rem 0 0.5rem 2rem;
}

.tree-cuentas-toggle {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.15rem 0;
  cursor: pointer;
}

.tree-cuentas-toggle:hover {
  color: var(--accent);
}

.tree-cuentas {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
}

.tree-cuenta-item {
  font-size: 0.88rem;
  color: var(--muted);
  padding: 0.15rem 0;
  font-family: Consolas, "Courier New", monospace;
}

.tree-content.hidden {
  display: none;
}

body[data-page="informe-config"],
body[data-page="informe-interno"] {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
}

body[data-page="informe-config"] > .modal,
body[data-page="informe-interno"] > .modal,
body[data-page="informe-ver"] > .modal {
  z-index: 2000;
}

body[data-page="informe-config"] .app-header,
body[data-page="informe-interno"] .app-header {
  flex-shrink: 0;
}

body[data-page="informe-config"] .app-main,
body[data-page="informe-interno"] .app-main {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 1.5rem;
}

body[data-page="informe-config"] .page-intro-row,
body[data-page="informe-interno"] .page-intro-row {
  flex-shrink: 0;
}

body[data-page="informe-config"] .data-panel,
body[data-page="informe-interno"] .data-panel {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

body[data-page="informe-config"] .toolbar,
body[data-page="informe-interno"] .toolbar {
  flex-shrink: 0;
}

body[data-page="informe-config"] .table-scroll-area,
body[data-page="informe-interno"] .table-scroll-area {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

body[data-page="informe-config"] .table-scroll-area .table-wrap,
body[data-page="informe-interno"] .table-scroll-area .table-wrap {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

body[data-page="informe-config"] .table-scroll-area .table-overlay,
body[data-page="informe-interno"] .table-scroll-area .table-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
}

body[data-page="informe-config"] .table-scroll-area .table-overlay.hidden,
body[data-page="informe-interno"] .table-scroll-area .table-overlay.hidden {
  display: none;
}

body[data-page="informe-config"] .data-table thead th,
body[data-page="informe-interno"] .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-header-bg);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.menu-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.menu-section h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.menu-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.menu-item {
  display: block;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.menu-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  background: var(--surface);
}

.menu-item.disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.menu-item.disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

.menu-item-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.menu-item-subtitle {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.menu-item-badge {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--accent-light);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.admin-menu-section {
  max-width: 520px;
}

.form-field-checkbox {
  margin-bottom: 0.35rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex: 0 0 auto;
}

.access-sections .form-field-checkbox {
  margin-bottom: 0;
}

.access-sections {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.access-checkbox-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.access-checkbox-item span {
  line-height: 1.2;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: var(--color-navy);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--header-text);
  border-color: rgba(202, 231, 238, 0.55);
}

.btn-secondary:hover {
  background: rgba(85, 178, 201, 0.18);
  border-color: var(--accent);
}

.message-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 640px;
}

.message-card h1 {
  margin-top: 0;
  font-weight: 600;
  color: var(--text);
}

.message-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.message-actions .btn-secondary {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.loading,
.error-message {
  margin-top: 1rem;
  color: var(--muted);
}

.error-message {
  color: var(--danger);
}

.hidden {
  display: none;
}

.app-main-wide {
  max-width: 1200px;
}

.page-intro-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.page-intro-row-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-breadcrumb {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.breadcrumb-separator {
  color: var(--muted);
}

.breadcrumb-link {
  display: inline;
  color: var(--accent);
  font-size: inherit;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.btn-on-light {
  color: var(--text);
}

.btn-on-light.btn-primary {
  color: var(--color-navy);
}

.btn-on-light.btn-primary:hover {
  color: #fff;
}

.btn-on-light.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-on-light.btn-secondary:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  margin-right: 0.35rem;
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid #f5c2c0;
}

.btn-danger:hover {
  background: #fef3f2;
}

.data-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  max-width: 420px;
}

.search-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.search-box input,
.search-box select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

.toolbar-checkbox {
  flex: 0 0 auto;
  max-width: none;
  min-width: 12rem;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.45rem;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
}

.checkbox-field input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.search-box input:focus,
.search-box select:focus,
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus,
.dual-listbox select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(85, 178, 201, 0.25);
}

.data-table th.col-importe,
.data-table td.col-importe {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

body[data-page="informe-lista"] .informe-lista-section {
  margin-bottom: 1.5rem;
}

body[data-page="informe-lista-ver"] .app-main.app-main-wide,
body[data-page="informe-lista-ver-detalle"] .app-main.app-main-wide {
  max-width: none;
  width: 100%;
}

body[data-page="informe-lista-ver"] .informe-lista-ver-section,
body[data-page="informe-lista-ver-detalle"] .informe-lista-ver-section {
  margin-bottom: 1.25rem;
}

body[data-page="informe-lista-ver"] .informe-lista-ver-section-title,
body[data-page="informe-lista-ver-detalle"] .informe-lista-ver-section-title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

body[data-page="informe-lista-ver"] .lista-ver-datos-heading,
body[data-page="informe-lista-ver-detalle"] .lista-ver-datos-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

body[data-page="informe-lista-ver"] .lista-ver-datos-heading .informe-lista-ver-section-title,
body[data-page="informe-lista-ver-detalle"] .lista-ver-datos-heading .informe-lista-ver-section-title {
  margin: 0;
}

body[data-page="informe-lista-ver"] .lista-ver-datos-heading .btn,
body[data-page="informe-lista-ver-detalle"] .lista-ver-datos-heading .btn {
  flex-shrink: 0;
}

body[data-page="informe-lista-ver"] .lista-ver-filtros-toolbar,
body[data-page="informe-lista-ver-detalle"] .lista-ver-filtros-toolbar {
  flex-wrap: wrap;
  align-items: flex-end;
  row-gap: 0.65rem;
}

body[data-page="informe-lista-ver"] .lista-ver-datos-layout,
body[data-page="informe-lista-ver-detalle"] .lista-ver-datos-layout {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  min-height: 12rem;
}

body[data-page="informe-lista-ver"] .lista-ver-campos-panel,
body[data-page="informe-lista-ver-detalle"] .lista-ver-campos-panel {
  flex: 0 0 auto;
  width: max-content;
  max-width: min(280px, 32vw);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #fafafa);
}

body[data-page="informe-lista-ver"] .lista-ver-campos-title,
body[data-page="informe-lista-ver-detalle"] .lista-ver-campos-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

body[data-page="informe-lista-ver"] .lista-ver-campos-list,
body[data-page="informe-lista-ver-detalle"] .lista-ver-campos-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(70vh, 640px);
  overflow: auto;
}

body[data-page="informe-lista-ver"] .lista-ver-campo-item,
body[data-page="informe-lista-ver-detalle"] .lista-ver-campo-item {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.88rem;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
}

body[data-page="informe-lista-ver"] .lista-ver-campo-item input,
body[data-page="informe-lista-ver-detalle"] .lista-ver-campo-item input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

body[data-page="informe-lista-ver"] .lista-ver-tabla-panel,
body[data-page="informe-lista-ver-detalle"] .lista-ver-tabla-panel {
  flex: 1 1 auto;
  min-width: 0;
}

body[data-page="informe-lista-ver"] .lista-ver-datos-count,
body[data-page="informe-lista-ver-detalle"] .lista-ver-datos-count {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--muted);
}

body[data-page="informe-lista-ver"] .lista-ver-table-wrap,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap {
  overflow: auto;
  max-height: min(75vh, 720px);
}

body[data-page="informe-lista-ver"] #lista-ver-datos-table tbody td,
body[data-page="informe-lista-ver-detalle"] #lista-ver-datos-table tbody td {
  padding: 0.32rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.25;
}

body[data-page="informe-lista-ver"] #lista-ver-datos-table thead tr:first-child th,
body[data-page="informe-lista-ver-detalle"] #lista-ver-datos-table thead tr:first-child th {
  padding: 0.38rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.25;
}

body[data-page="informe-lista-ver"] .lista-ver-table-wrap .data-table thead tr:first-child th,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap .data-table thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--table-header-bg);
  box-shadow: 0 1px 0 var(--border);
  overflow: visible;
  vertical-align: top;
}

body[data-page="informe-lista-ver"] .lista-ver-table-wrap .data-table thead tr.filter-row th,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap .data-table thead tr.filter-row th {
  position: sticky;
  top: var(--lista-ver-thead-label-height, 2.2rem);
  z-index: 3;
  background: var(--surface);
  padding: 0.28rem 0.4rem;
  vertical-align: middle;
  box-shadow: 0 1px 0 var(--border);
}

body[data-page="informe-lista-ver"] .lista-ver-table-wrap .data-table thead tr.filter-row input,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap .data-table thead tr.filter-row input {
  width: 100%;
  min-width: 3rem;
  padding: 0.28rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.76rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

body[data-page="informe-lista-ver"] .lista-ver-table-wrap .data-table thead tr.filter-row input:focus,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap .data-table thead tr.filter-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

body[data-page="informe-lista-ver"] .lista-ver-table-wrap th.lista-ver-col-num,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap th.lista-ver-col-num,
body[data-page="informe-lista-ver"] .lista-ver-table-wrap td.lista-ver-col-num,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap td.lista-ver-col-num {
  text-align: right;
}

body[data-page="informe-lista-ver"] .lista-ver-table-wrap th.lista-ver-col-num .lista-ver-col-header-inner,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap th.lista-ver-col-num .lista-ver-col-header-inner {
  justify-content: flex-end;
}

body[data-page="informe-lista-ver"] .lista-ver-table-wrap th.lista-ver-col-num .lista-ver-sort-btn,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap th.lista-ver-col-num .lista-ver-sort-btn {
  justify-content: flex-end;
  text-align: right;
}

body[data-page="informe-lista-ver"] .lista-ver-table-wrap td.lista-ver-col-num,
body[data-page="informe-lista-ver-detalle"] .lista-ver-table-wrap td.lista-ver-col-num {
  font-variant-numeric: tabular-nums;
}

body[data-page="informe-lista-ver"] .lista-ver-col-header-inner,
body[data-page="informe-lista-ver-detalle"] .lista-ver-col-header-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  min-width: 0;
}

body[data-page="informe-lista-ver"] .lista-ver-col-title,
body[data-page="informe-lista-ver-detalle"] .lista-ver-col-title {
  overflow: visible;
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
}

body[data-page="informe-lista-ver"] .lista-ver-sort-btn,
body[data-page="informe-lista-ver-detalle"] .lista-ver-sort-btn {
  display: inline-flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.1rem;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
  text-align: left;
  white-space: normal;
}

body[data-page="informe-lista-ver"] .lista-ver-sort-btn .lista-ver-col-title,
body[data-page="informe-lista-ver-detalle"] .lista-ver-sort-btn .lista-ver-col-title {
  min-width: 0;
}

body[data-page="informe-lista-ver"] .lista-ver-sort-btn .sort-indicator,
body[data-page="informe-lista-ver-detalle"] .lista-ver-sort-btn .sort-indicator {
  flex-shrink: 0;
  font-size: 0.72rem;
  line-height: 1;
}

body[data-page="informe-lista-ver"] #lista-ver-datos-table.is-col-draggable thead tr:first-child th.col-draggable,
body[data-page="informe-lista-ver-detalle"] #lista-ver-datos-table.is-col-draggable thead tr:first-child th.col-draggable {
  transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

body[data-page="informe-lista-ver"] #lista-ver-datos-table.is-col-draggable thead tr:first-child th.col-drag-over,
body[data-page="informe-lista-ver-detalle"] #lista-ver-datos-table.is-col-draggable thead tr:first-child th.col-drag-over {
  background: var(--accent-light);
  box-shadow: inset 0 0 0 2px var(--accent);
}

body[data-page="informe-lista-ver"] #lista-ver-datos-table.is-col-draggable thead tr:first-child th.col-dragging,
body[data-page="informe-lista-ver-detalle"] #lista-ver-datos-table.is-col-draggable thead tr:first-child th.col-dragging {
  opacity: 0.65;
}

body[data-page="informe-lista-ver"] .lista-ver-datos-truncado,
body[data-page="informe-lista-ver-detalle"] .lista-ver-datos-truncado {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

body[data-page="informe-lista-ver"] .filterable-select,
body[data-page="informe-lista-ver-detalle"] .filterable-select {
  position: relative;
  min-width: 220px;
}

body[data-page="informe-lista-ver"] .filterable-select-input,
body[data-page="informe-lista-ver-detalle"] .filterable-select-input {
  width: 100%;
  min-width: 220px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}

body[data-page="informe-lista-ver"] .filterable-select-input:focus,
body[data-page="informe-lista-ver-detalle"] .filterable-select-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

body[data-page="informe-lista-ver"] .filterable-select-menu,
body[data-page="informe-lista-ver-detalle"] .filterable-select-menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body[data-page="informe-lista-ver"] .filterable-select-option,
body[data-page="informe-lista-ver-detalle"] .filterable-select-option {
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-page="informe-lista-ver"] .filterable-select-option:hover,
body[data-page="informe-lista-ver"] .filterable-select-option:focus,
body[data-page="informe-lista-ver-detalle"] .filterable-select-option:hover,
body[data-page="informe-lista-ver-detalle"] .filterable-select-option:focus {
  background: var(--accent-light);
}

body[data-page="informe-lista-ver"] .filterable-select-hint,
body[data-page="informe-lista-ver"] .filterable-select-empty,
body[data-page="informe-lista-ver-detalle"] .filterable-select-hint,
body[data-page="informe-lista-ver-detalle"] .filterable-select-empty {
  padding: 0.35rem 0.65rem;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: default;
}

body[data-page="informe-lista"] .informe-lista-section-title {
  margin: 0;
  font-size: 1.15rem;
}

body[data-page="informes-ver"] .informes-ver-row.is-clickable {
  cursor: pointer;
}

body[data-page="informes-ver"] .informes-ver-row.is-clickable:hover {
  background: var(--surface-muted, rgba(0, 0, 0, 0.03));
}

body[data-page="informe-ver"] .table-scroll-area {
  position: relative;
  min-height: 12rem;
}

body[data-page="informe-ver"] .table-scroll-area .table-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
}

body[data-page="informe-ver"] .table-scroll-area .table-overlay.hidden {
  display: none;
}

.informe-ver-flujo .informe-ver-etiqueta {
  width: 100%;
}

.informe-ver-flujo .informe-ver-etiqueta.is-bold {
  font-weight: 700;
}

.informe-ver-flujo .informe-ver-etiqueta.is-indent-1 {
  padding-left: 2.5rem;
}

.informe-ver-flujo .col-importe {
  width: 12rem;
}

.informe-ver-flujo-columnas .col-importe {
  width: 9rem;
  min-width: 7rem;
}

.toolbar-meta {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--table-header-bg);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.data-table tbody tr:hover {
  background: var(--table-row-hover);
}

.sort-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.sort-btn.is-active {
  color: var(--text);
  font-weight: 700;
}

.col-actions {
  width: 380px;
  white-space: nowrap;
}

.col-orden {
  width: 88px;
  white-space: nowrap;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  margin-right: 0.35rem;
  color: var(--muted);
  cursor: grab;
  user-select: none;
  letter-spacing: -0.15em;
  font-size: 0.95rem;
  vertical-align: middle;
}

.drag-handle:active {
  cursor: grabbing;
}

#epigrafes-table.is-draggable tbody tr.row-draggable {
  transition: background-color 0.15s ease;
}

#epigrafes-table.is-draggable tbody tr.row-dragging {
  opacity: 0.55;
}

#epigrafes-table.is-draggable tbody tr.row-drag-over {
  background: var(--accent-light);
  box-shadow: inset 0 0 0 2px var(--accent);
}

#epigrafes-table.is-reordering {
  opacity: 0.72;
  pointer-events: none;
}

#filtros-table.is-draggable tbody tr.row-draggable {
  transition: background-color 0.15s ease;
}

#filtros-table.is-draggable tbody tr.row-dragging {
  opacity: 0.55;
}

#filtros-table.is-draggable tbody tr.row-drag-over {
  background: var(--accent-light);
  box-shadow: inset 0 0 0 2px var(--accent);
}

#filtros-table.is-reordering {
  opacity: 0.72;
  pointer-events: none;
}

.empty-state {
  padding: 1.5rem 0 0.5rem;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 44, 50, 0.5);
}

.modal-dialog {
  position: relative;
  width: min(520px, calc(100% - 2rem));
  margin: 8vh auto 0;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.modal-dialog-wait {
  width: min(360px, calc(100% - 2rem));
  margin: 30vh auto 0;
  text-align: center;
  padding: 2rem 1.5rem;
}

.modal-wait-message {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.modal-dialog-recalcular {
  width: min(480px, calc(100% - 2rem));
}

.modal-wait-elapsed {
  margin: 0.85rem 0 0;
  font-size: 1.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text);
}

.modal-wait-hint {
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.modal-header h2.modal-title-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-header h2.modal-title-with-icon .icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--accent);
  flex-shrink: 0;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.modal-close .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.menu-item-with-icon .menu-item-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.menu-item-with-icon .menu-item-title .icon {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--accent);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-field.hidden {
  display: none;
}

.form-field label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.form-field input[type="checkbox"] {
  width: auto;
  padding: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .page-intro-row {
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
