:root {
  --bg: #f2fbf9;
  --ink: #10232b;
  --muted: #5e7178;
  --line: #cde8e5;
  --panel: #ffffff;
  --navy: #07597a;
  --cyan: #18b7d5;
  --green: #0adf78;
  --green-dark: #07897c;
  --lime: #72f21e;
  --red: #d92d20;
  --red-soft: #fff1f0;
  --amber: #f79009;
  --amber-soft: #fff7e6;
  --blue: #0a6f92;
  --blue-soft: #eefaff;
  --shadow: 0 24px 58px rgba(7, 89, 122, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 7% 2%, rgba(114, 242, 30, 0.24), transparent 28rem),
    radial-gradient(circle at 82% 9%, rgba(24, 183, 213, 0.22), transparent 34rem),
    linear-gradient(135deg, #f7fffb, #eefaf8 52%, #eef8ff);
  color: var(--ink);
  display: grid;
  font-family: "Segoe UI", Tahoma, sans-serif;
  grid-template-columns: 286px minmax(0, 1fr);
}

body[data-theme="dark"] {
  --bg: #061b24;
  --ink: #eefcff;
  --muted: #a7c2ca;
  --line: rgba(137, 214, 220, 0.24);
  --panel: rgba(9, 38, 51, 0.9);
  --navy: #9ee9ef;
  --cyan: #27d5e6;
  --green: #22e58b;
  --green-dark: #0bb47b;
  --lime: #72f21e;
  --red-soft: rgba(217, 45, 32, 0.16);
  --amber-soft: rgba(247, 144, 9, 0.16);
  --blue-soft: rgba(24, 183, 213, 0.14);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  background:
    radial-gradient(circle at 8% 3%, rgba(114, 242, 30, 0.18), transparent 28rem),
    radial-gradient(circle at 85% 8%, rgba(24, 183, 213, 0.18), transparent 34rem),
    linear-gradient(135deg, #061b24, #092b38 55%, #031119);
}

.sidebar {
  background:
    radial-gradient(circle at 4% 3%, rgba(114, 242, 30, 0.28), transparent 13rem),
    radial-gradient(circle at 100% 10%, rgba(24, 183, 213, 0.28), transparent 16rem),
    linear-gradient(180deg, #07597a, #06425c 48%, #042a3c);
  color: #f9fff9;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100vh;
  padding: 20px;
  position: sticky;
  top: 0;
}

.brand-logo {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(3, 38, 54, 0.24), inset 0 0 0 1px rgba(7, 89, 122, 0.06);
  display: block;
  height: auto;
  margin-bottom: 14px;
  object-fit: contain;
  padding: 9px 10px;
  width: 100%;
}

.brand span, .eyebrow {
  color: #0f6f86;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  align-items: center;
  display: inline-flex;
  gap: 9px;
}

.eyebrow::before {
  background: linear-gradient(135deg, #0adf78, #0f6f86);
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 7px;
  width: 7px;
}

.brand span {
  color: #c8ffe7;
  text-shadow: 0 1px 12px rgba(10, 223, 120, 0.24);
}

.brand h1 {
  color: #ffffff;
  font-size: 31px;
  letter-spacing: -0.06em;
  line-height: 0.95;
  margin: 10px 0;
}

.brand p, .rule-box p, small {
  color: rgba(241, 255, 251, 0.8);
  line-height: 1.45;
}

.upload-box, .rule-box, .site-box {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(205, 232, 229, 0.32);
  border-radius: 22px;
  display: grid;
  gap: 9px;
  padding: 12px;
}

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

.site-box-head span {
  background: rgba(200, 255, 231, 0.16);
  border: 1px solid rgba(200, 255, 231, 0.28);
  border-radius: 999px;
  color: #c8ffe7;
  font-size: 12px;
  font-weight: 900;
  max-width: 128px;
  min-width: 72px;
  overflow: hidden;
  padding: 3px 8px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-tabs {
  display: grid;
  gap: 8px;
}

.site-tab {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(205, 232, 229, 0.26);
  border-radius: 14px;
  color: #f2fffb;
  cursor: pointer;
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  text-align: left;
  width: 100%;
}

.site-tab strong {
  color: #c8ffe7;
  font-size: 13px;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-transform: uppercase;
}

.site-tab span {
  color: rgba(241, 255, 251, 0.78);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.site-tab.active {
  background: linear-gradient(135deg, rgba(114, 242, 30, 0.35), rgba(24, 183, 213, 0.28));
  border-color: rgba(200, 255, 231, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.site-empty {
  color: rgba(241, 255, 251, 0.76);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

.session-box {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(205, 232, 229, 0.32);
  border-radius: 18px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.session-box span {
  color: #c8ffe7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.session-box strong {
  color: #ffffff;
}

.sidebar-link {
  color: #e9fff6;
  font-weight: 900;
}

.rule-box select {
  font-size: 14px;
  line-height: 1.25;
  min-height: 54px;
  white-space: normal;
}

.rule-static {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(205, 232, 229, 0.3);
  border-radius: 12px;
  color: #f2fffb;
  font-weight: 900;
  line-height: 1.25;
  padding: 10px 12px;
}

label {
  font-weight: 800;
}

input, select, button, .download {
  border: 1px solid var(--line);
  border-radius: 14px;
  font: inherit;
  padding: 10px 12px;
  width: 100%;
}

input, select {
  background: #fffefa;
  color: var(--ink);
}

.native-file {
  clip: rect(0 0 0 0);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.file-picker {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(205, 232, 229, 0.75);
  border-radius: 16px;
  color: #17313b;
  cursor: pointer;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.file-picker:hover {
  border-color: rgba(10, 223, 120, 0.8);
  box-shadow: 0 12px 26px rgba(10, 223, 120, 0.16);
  transform: translateY(-1px);
}

.file-picker span {
  color: #07597a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.file-picker strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button, .download {
  background: linear-gradient(135deg, #72f21e, #0adf78 55%, #18b7d5);
  border: 0;
  color: #082017;
  cursor: pointer;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.secondary-action, .table-action {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  color: #07597a;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

small {
  overflow-wrap: anywhere;
}

.workspace {
  min-width: 0;
  padding: 18px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  position: relative;
}

.topbar h2 {
  font-size: clamp(24px, 3.4vw, 40px);
  letter-spacing: -0.055em;
  line-height: 0.95;
  margin: 8px 0 0;
}

.status {
  background: linear-gradient(135deg, #ffffff, #f2fff8);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  padding: 8px 14px;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(7, 89, 122, 0.12);
  padding: 8px 14px;
  width: auto;
}

.user-menu {
  position: relative;
}

.user-menu summary {
  align-items: center;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(7, 89, 122, 0.12);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-weight: 900;
  gap: 8px;
  list-style: none;
  min-height: 39px;
  padding: 8px 14px;
  white-space: nowrap;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu summary::after {
  color: var(--muted);
  content: "▾";
  font-size: 12px;
  line-height: 1;
}

.user-menu[open] summary::after {
  transform: rotate(180deg);
}

.user-menu-panel {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(7, 89, 122, 0.18);
  display: grid;
  gap: 8px;
  min-width: 230px;
  padding: 10px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
}

.user-menu-meta {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
  padding: 4px 4px 9px;
}

.user-menu-meta strong {
  color: var(--ink);
  font-size: 14px;
}

.user-menu-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.user-menu-panel a,
.menu-logout {
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  display: block;
  font-weight: 900;
  padding: 9px 10px;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.user-menu-panel a:hover,
.menu-logout:hover {
  background: var(--blue-soft);
}

.metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin-bottom: 18px;
}

.metric, .search-panel, .table-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.metric {
  min-height: 84px;
  padding: 13px;
}

.metric strong {
  display: block;
  font-size: 25px;
  letter-spacing: -0.05em;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric.danger { background: linear-gradient(135deg, #fff3f0, #ffe8e2); }
.metric.warn { background: linear-gradient(135deg, #fff9e8, #fff0c8); }
.metric.ok { background: linear-gradient(135deg, #e9fff6, #d8ffec); }
.metric.info { background: linear-gradient(135deg, #eefaff, #e2f4ff); }

.search-panel, .table-panel {
  margin-top: 18px;
  padding: 16px;
}

.quick-search {
  margin-bottom: 14px;
}

.quick-search input {
  font-size: 16px;
  font-weight: 700;
  margin-top: 8px;
  padding: 14px;
}

.filters {
  display: grid;
  align-items: stretch;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.filters input,
.filters select,
.filters .check {
  min-width: 0;
  min-height: 58px;
}

#cargo {
  grid-column: span 2;
}

#estado {
  min-width: 230px;
}

.check {
  align-items: center;
  background: #f2fff8;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 8px;
  line-height: 1.2;
  padding: 9px 13px;
  white-space: normal;
}

.check input {
  width: auto;
}

.table-head {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.duplicate-notice {
  align-items: flex-start;
  background: linear-gradient(135deg, #fff8e5, #fff1c9);
  border: 1px solid #f5c46b;
  border-radius: 14px;
  color: #553106;
  display: flex;
  gap: 10px;
  line-height: 1.35;
  margin: -2px 0 14px;
  padding: 11px 13px;
}

.duplicate-notice strong {
  color: #9a4a00;
  flex: 0 0 auto;
  font-weight: 900;
  white-space: nowrap;
}

.duplicate-notice span {
  font-weight: 700;
}

.is-hidden {
  display: none !important;
}

.table-head h3 {
  font-size: 19px;
  margin: 6px 0 0;
}

#rowCounter {
  color: var(--muted);
  font-weight: 800;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 18px;
  max-width: 100%;
  max-height: 68vh;
  overflow: auto;
}

table {
  border-collapse: collapse;
  font-size: 11px;
  min-width: 2280px;
  width: 100%;
}

th {
  background: linear-gradient(135deg, #07597a, #06425c);
  color: #fff;
  position: sticky;
  text-align: left;
  top: 0;
  z-index: 1;
}

td, th {
  border-bottom: 1px solid #e9eefb;
  padding: 7px 8px;
  vertical-align: top;
}

td.cargo {
  min-width: 360px;
}

.source-col {
  max-width: 180px;
  min-width: 130px;
  overflow-wrap: anywhere;
}

.mono {
  font-family: Consolas, monospace;
  font-weight: 800;
}

.badge {
  border-radius: 999px;
  color: white;
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  padding: 4px 8px;
  white-space: nowrap;
}

.OK {
  background: #87d9a6;
  color: #06381f;
}
.badge.MATCH_EXACTO {
  background: #67d596;
  color: #05341d;
}
.badge.MATCH_PARCIAL,
.badge.SIN_CONSECUTIVO,
.badge.AQUILA_NO_FACTURADO,
.badge.MEDICO_FALTANTE {
  background: #f2bd5f;
  color: #563405;
}
.badge.AMBIGUO,
.badge.DUPLICADO {
  background: #ec7068;
  color: #fff7f5;
}
.ERROR_PRECIO { background: var(--red); }
.SIN_TARIFA { background: var(--blue); }
.DUPLICADO_OPERATIVO {
  background: #f4a7a2;
  color: #5e1510;
}
.CANTIDAD_INVALIDA, .VALOR_INVALIDO, .REVISAR_VARIACION { background: var(--amber); }
tr.ERROR_PRECIO td {
  background: #ffe5e2;
  border-bottom-color: #f4b7b1;
}
tr.ERROR_PRECIO:nth-child(even) td {
  background: #ffdcd8;
}
tr.REVISAR_VARIACION td {
  background: #fff0cf;
  border-bottom-color: #eccb82;
}
tr.REVISAR_VARIACION:nth-child(even) td {
  background: #ffe8bd;
}
tr.SIN_TARIFA td {
  background: #e3f4ff;
  border-bottom-color: #b5d7eb;
}
tr.SIN_TARIFA:nth-child(even) td {
  background: #d7edf9;
}
tr.CANTIDAD_INVALIDA td,
tr.VALOR_INVALIDO td {
  background: #fff3d9;
  border-bottom-color: #e8c681;
}
tr.CANTIDAD_INVALIDA:nth-child(even) td,
tr.VALOR_INVALIDO:nth-child(even) td {
  background: #ffeac2;
}
tr.OK td {
  background: #effaf3;
  border-bottom-color: #cde8d7;
}
tr.OK:nth-child(even) td {
  background: #e7f5ec;
}
tr.DUPLICADO_OK td {
  background: #dff4e7;
  border-bottom-color: #b7dbc7;
}
tr.DUPLICADO_OK:nth-child(even) td {
  background: #d4ecd8;
}
tr.DUPLICADO_OK .DUPLICADO_OPERATIVO {
  background: #f4a7a2;
  color: #5e1510;
}
.diff { font-weight: 900; }
.empty {
  color: var(--muted);
  font-size: 17px;
  padding: 36px;
  text-align: center;
}

.table-tools {
  align-items: center;
  display: flex;
  gap: 12px;
}

.table-tools label {
  color: var(--muted);
}

.table-tools select {
  min-width: 86px;
  padding: 8px 10px;
}

body[data-theme="dark"] .table-tools select,
body[data-theme="dark"] #estado,
body[data-theme="dark"] #mode {
  background-color: rgba(13, 49, 62, 0.96);
  color: #e6f7fa;
}

body[data-theme="dark"] .rule-static {
  background: rgba(13, 49, 62, 0.92);
  border-color: rgba(137, 214, 220, 0.3);
}

.pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 16px;
}

.page-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
  min-width: 38px;
  padding: 8px 10px;
  width: auto;
}

.page-btn.active {
  background: linear-gradient(135deg, var(--navy), var(--cyan));
  color: #fff;
}

.page-btn:disabled {
  background: #eef2f7;
  color: #98a2b3;
  cursor: not-allowed;
}

.page-gap {
  color: var(--muted);
  font-weight: 900;
  padding: 0 4px;
}

body[data-theme="dark"] .sidebar {
  background:
    radial-gradient(circle at 4% 3%, rgba(114, 242, 30, 0.2), transparent 13rem),
    radial-gradient(circle at 100% 10%, rgba(24, 183, 213, 0.2), transparent 16rem),
    linear-gradient(180deg, #06384d, #052838 48%, #03141d);
}

body[data-theme="dark"] .brand-logo {
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .brand span {
  color: #aefbd1;
}

body[data-theme="dark"] .brand p,
body[data-theme="dark"] .rule-box p,
body[data-theme="dark"] .site-empty,
body[data-theme="dark"] small {
  color: rgba(238, 252, 255, 0.78);
}

body[data-theme="dark"] .upload-box,
body[data-theme="dark"] .rule-box,
body[data-theme="dark"] .site-box {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(137, 214, 220, 0.2);
}

body[data-theme="dark"] .site-tab {
  background: rgba(13, 49, 62, 0.72);
  border-color: rgba(137, 214, 220, 0.22);
}

body[data-theme="dark"] .duplicate-notice {
  background: rgba(181, 71, 8, 0.18);
  border-color: rgba(251, 191, 36, 0.42);
  color: #ffe8b5;
}

body[data-theme="dark"] .duplicate-notice strong {
  color: #ffd27a;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select {
  background: rgba(13, 49, 62, 0.92);
  border-color: rgba(137, 214, 220, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #e6f7fa;
}

body[data-theme="dark"] input::placeholder {
  color: #9bb4bb;
}

body[data-theme="dark"] .file-picker {
  background: rgba(13, 49, 62, 0.92);
  border-color: rgba(137, 214, 220, 0.3);
  color: #e6f7fa;
}

body[data-theme="dark"] .file-picker span {
  color: #70dccd;
}

body[data-theme="dark"] .file-picker:hover {
  border-color: rgba(112, 220, 205, 0.72);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

body[data-theme="dark"] .metric,
body[data-theme="dark"] .search-panel,
body[data-theme="dark"] .table-panel {
  background: rgba(8, 34, 46, 0.9);
  border-color: rgba(137, 214, 220, 0.24);
}

body[data-theme="dark"] .status,
body[data-theme="dark"] .theme-toggle,
body[data-theme="dark"] .user-menu summary,
body[data-theme="dark"] .page-btn {
  background: rgba(9, 38, 51, 0.88);
  border-color: rgba(137, 214, 220, 0.28);
  color: var(--ink);
}

body[data-theme="dark"] .user-menu-panel {
  background: rgba(9, 38, 51, 0.98);
  border-color: rgba(137, 214, 220, 0.28);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.34);
}

body[data-theme="dark"] .user-menu-panel a,
body[data-theme="dark"] .menu-logout {
  color: var(--ink);
}

body[data-theme="dark"] .user-menu-panel a:hover,
body[data-theme="dark"] .menu-logout:hover {
  background: rgba(39, 213, 230, 0.12);
}

body[data-theme="dark"] .metric span,
body[data-theme="dark"] #rowCounter,
body[data-theme="dark"] .table-tools label {
  color: var(--muted);
}

body[data-theme="dark"] .metric.danger { background: linear-gradient(135deg, rgba(151, 58, 51, 0.22), rgba(151, 58, 51, 0.1)); }
body[data-theme="dark"] .metric.warn { background: linear-gradient(135deg, rgba(173, 121, 44, 0.22), rgba(173, 121, 44, 0.1)); }
body[data-theme="dark"] .metric.ok { background: linear-gradient(135deg, rgba(34, 229, 139, 0.2), rgba(34, 229, 139, 0.08)); }
body[data-theme="dark"] .metric.info { background: linear-gradient(135deg, rgba(39, 213, 230, 0.18), rgba(39, 213, 230, 0.08)); }

body[data-theme="dark"] .check {
  background: rgba(223, 232, 236, 0.08);
  border-color: rgba(167, 194, 202, 0.28);
  color: #d7e8ed;
}

body[data-theme="dark"] th {
  background: linear-gradient(135deg, #0a4d68, #053043);
  color: #f4fdff;
}

body[data-theme="dark"] td,
body[data-theme="dark"] th {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

body[data-theme="dark"] tr.OK td {
  background: rgba(33, 86, 62, 0.46);
  border-bottom-color: rgba(151, 214, 177, 0.12);
  color: #eefcf4;
}

body[data-theme="dark"] tr.OK:nth-child(even) td {
  background: rgba(29, 76, 55, 0.52);
}

body[data-theme="dark"] .OK {
  background: #7fc99d;
  color: #052819;
}

body[data-theme="dark"] .DUPLICADO_OPERATIVO {
  background: #e7aaa5;
  color: #4e110d;
}

body[data-theme="dark"] tr.DUPLICADO_OK td {
  background: rgba(21, 88, 63, 0.82);
  border-bottom-color: rgba(155, 220, 188, 0.18);
  color: #ecfff5;
}

body[data-theme="dark"] tr.DUPLICADO_OK:nth-child(even) td {
  background: rgba(18, 77, 56, 0.88);
}

body[data-theme="dark"] tr.DUPLICADO_OK .DUPLICADO_OPERATIVO {
  background: #e7aaa5;
  color: #4e110d;
}

body[data-theme="dark"] tr.ERROR_PRECIO td {
  background: rgba(108, 58, 60, 0.78);
  border-bottom-color: rgba(255, 200, 194, 0.16);
  box-shadow: none;
  color: #fff3f1;
}

body[data-theme="dark"] tr.ERROR_PRECIO:nth-child(even) td {
  background: rgba(96, 49, 52, 0.84);
}

body[data-theme="dark"] tr.REVISAR_VARIACION td {
  background: rgba(92, 73, 38, 0.78);
  border-bottom-color: rgba(255, 220, 150, 0.14);
  color: #fff8e8;
}

body[data-theme="dark"] tr.REVISAR_VARIACION:nth-child(even) td {
  background: rgba(80, 63, 34, 0.84);
}

body[data-theme="dark"] tr.SIN_TARIFA td {
  background: rgba(24, 82, 111, 0.74);
  border-bottom-color: rgba(158, 220, 239, 0.14);
  color: #effbff;
}

body[data-theme="dark"] tr.SIN_TARIFA:nth-child(even) td {
  background: rgba(20, 72, 99, 0.82);
}

body[data-theme="dark"] tr.CANTIDAD_INVALIDA td,
body[data-theme="dark"] tr.VALOR_INVALIDO td {
  background: rgba(101, 69, 31, 0.78);
  border-bottom-color: rgba(255, 209, 130, 0.14);
  color: #fff7e8;
}

body[data-theme="dark"] tr.CANTIDAD_INVALIDA:nth-child(even) td,
body[data-theme="dark"] tr.VALOR_INVALIDO:nth-child(even) td {
  background: rgba(90, 60, 28, 0.84);
}

body[data-theme="dark"] .ERROR_PRECIO {
  background: #d9a09a;
  color: #4d100c;
}

body[data-theme="dark"] .SIN_TARIFA {
  background: #89c5db;
  color: #063241;
}

body[data-theme="dark"] .REVISAR_VARIACION,
body[data-theme="dark"] .CANTIDAD_INVALIDA,
body[data-theme="dark"] .VALOR_INVALIDO {
  background: #d3ad68;
  color: #3d2603;
}

body[data-theme="dark"] .empty {
  color: var(--muted);
}

body[data-theme="dark"].modules-page {
  background:
    radial-gradient(circle at 10% 4%, rgba(114, 242, 30, 0.12), transparent 26rem),
    radial-gradient(circle at 90% 2%, rgba(39, 213, 230, 0.14), transparent 30rem),
    linear-gradient(135deg, #061b24, #092b38 58%, #031119);
}

body[data-theme="dark"] .module-header,
body[data-theme="dark"] .module-card {
  background: rgba(8, 34, 46, 0.92);
  border-color: rgba(137, 214, 220, 0.22);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .module-logo {
  background: #ffffff;
}

body[data-theme="dark"] .module-nav-link,
body[data-theme="dark"] .module-card strong {
  color: var(--navy);
}

body[data-theme="dark"] .module-card p,
body[data-theme="dark"] .module-subtitle {
  color: var(--muted);
}

body[data-theme="dark"] .module-role,
body[data-theme="dark"] .module-card.is-ready .module-status {
  background: rgba(34, 229, 139, 0.16);
  border-color: rgba(34, 229, 139, 0.28);
  color: #aefbd1;
}

body[data-theme="dark"] .module-card.is-soon .module-status {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

@media (max-width: 1180px) {
  body {
    display: block;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

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

  .module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .metrics, .filters, .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  #cargo,
  #estado {
    grid-column: auto;
    min-width: 0;
  }

  .top-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .user-menu summary,
  .theme-toggle,
  .status {
    justify-content: center;
    text-align: center;
    width: 100%;
  }

  .user-menu-panel {
    left: 0;
    min-width: 0;
    right: 0;
  }

  .module-shell {
    padding: 18px;
  }

  .module-header,
  .module-brand-block,
  .module-welcome {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .module-nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .module-logo {
    height: 70px;
    width: 70px;
  }
}

.auth-page,
.admin-page,
.modules-page {
  display: block;
  background: #f4f8fb;
}

.admin-page,
.modules-page {
  min-height: 100vh;
}

.auth-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.auth-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 440px;
  padding: 24px;
  width: 100%;
}

.auth-logo {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  max-width: 220px;
  padding: 10px;
  width: 100%;
}

.auth-panel h1,
.admin-header h1 {
  letter-spacing: -0.04em;
  margin: 0;
}

.auth-panel form,
.admin-card {
  display: grid;
  gap: 10px;
}

.module-shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 24px;
}

.module-header {
  align-items: center;
  background: linear-gradient(135deg, #ffffff, #f7fcfd);
  border: 1px solid #dce8ee;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 35, 43, 0.08);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 18px;
}

.module-brand-block {
  align-items: center;
  display: flex;
  gap: 16px;
}

.module-logo {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 76px;
  object-fit: contain;
  padding: 8px;
  width: 76px;
}

.module-header h1,
.module-welcome h2 {
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 6px 0 0;
}

.module-subtitle {
  color: var(--muted);
  display: inline-block;
  font-weight: 700;
  margin-top: 6px;
}

.module-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.module-nav form {
  margin: 0;
}

.module-nav-link {
  color: var(--navy);
  font-weight: 900;
  text-decoration: none;
}

.module-welcome {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin: 26px 0 16px;
}

.module-role {
  background: #e9fff6;
  border: 1px solid #bfead2;
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  padding: 8px 12px;
}

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

.module-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dce8ee;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(16, 35, 43, 0.08);
  color: var(--ink);
  display: grid;
  gap: 12px;
  min-height: 230px;
  padding: 22px;
  text-decoration: none;
}

.module-card h3 {
  font-size: 26px;
  letter-spacing: -0.03em;
  margin: 0;
}

.module-card p {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
  margin: 0;
}

.module-card strong {
  align-self: end;
  color: var(--navy);
}

.module-status {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  justify-self: start;
  padding: 6px 10px;
}

.module-card.is-ready {
  border-color: rgba(10, 223, 120, 0.42);
}

.module-card.is-ready .module-status {
  background: #e9fff6;
  color: var(--green-dark);
}

.module-card.is-soon {
  opacity: 0.78;
}

.module-card.is-soon .module-status {
  background: #eef3f6;
  color: var(--muted);
}

.flash {
  border-radius: 12px;
  font-weight: 800;
  padding: 10px 12px;
}

.flash.error {
  background: var(--red-soft);
  color: var(--red);
}

.flash.success {
  background: #e9fff6;
  color: var(--green-dark);
}

.admin-shell {
  margin: 0 auto;
  max-width: 1500px;
  padding: 24px;
}

.admin-header {
  align-items: center;
  background: linear-gradient(135deg, #ffffff, #f7fcfd);
  border: 1px solid #dce8ee;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 35, 43, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
}

.admin-brand-block {
  align-items: center;
  display: flex;
  gap: 16px;
  min-width: 0;
}

.admin-logo {
  background: #ffffff;
  border: 1px solid #dce8ee;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(7, 89, 122, 0.12);
  height: auto;
  padding: 7px 9px;
  width: 176px;
}

.admin-subtitle {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-top: 6px;
}

.admin-nav {
  align-items: center;
  display: flex;
  gap: 12px;
}

.admin-nav .sidebar-link {
  color: var(--navy);
}

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

.admin-card {
  background: linear-gradient(135deg, #ffffff, #f9fdff);
  border: 1px solid #dce8ee;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 35, 43, 0.08);
  padding: 16px;
}

.admin-card h2 {
  margin: 0;
}

.admin-help-card {
  align-content: start;
}

.role-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.role-list div {
  border-left: 3px solid var(--cyan);
  padding-left: 10px;
}

.role-list dt {
  color: var(--navy);
  font-weight: 900;
}

.role-list dd {
  color: var(--muted);
  margin: 3px 0 0;
}

.message-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.table-wrap.compact table {
  min-width: 980px;
}

.admin-page .table-panel {
  background: #ffffff;
  border-color: #dce8ee;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 35, 43, 0.08);
}

.admin-page .table-wrap {
  border-radius: 6px;
}

.admin-page .activity-log-wrap {
  max-height: 68vh;
  overflow: auto;
  scrollbar-gutter: stable;
}

.log-toolbar {
  align-items: end;
  background: #f7fbfd;
  border: 1px solid #dce8ee;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(130px, 1fr)) repeat(2, minmax(130px, 0.8fr)) auto;
  margin: 0 0 12px;
  padding: 12px;
}

.log-toolbar label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 900;
  gap: 5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.log-toolbar input,
.log-toolbar select {
  min-height: 38px;
}

.log-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.log-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.log-chip {
  background: #eefaff;
  border: 1px solid #cfe2e8;
  border-radius: 999px;
  color: var(--navy);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 12px;
}

.log-chip.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

.admin-overview {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  margin-bottom: 18px;
}

.admin-stat {
  background: linear-gradient(135deg, #ffffff, #f8fdff);
  border: 1px solid #dce8ee;
  border-left: 4px solid var(--cyan);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(16, 35, 43, 0.06);
  padding: 14px 16px;
}

.admin-stat strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.admin-stat span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 900;
  margin-top: 7px;
  text-transform: uppercase;
}

.admin-stat small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.table-action {
  font-size: 12px;
  padding: 7px 10px;
}

.danger-action {
  background: var(--red-soft);
  color: var(--red);
}

.inline-admin-form {
  align-items: center;
  display: flex;
  gap: 6px;
  margin: 0 0 6px;
}

.user-edit-form {
  margin: 0;
}

.table-input {
  background: #ffffff;
  border: 1px solid #cfe2e8;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  min-width: 180px;
  padding: 7px 9px;
}

.compact-input {
  min-width: 130px;
}

.password-input {
  margin-bottom: 6px;
  min-width: 230px;
}

.log-summary {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-top: 18px;
}

.log-summary .metric {
  border-radius: 8px;
  min-height: 72px;
  padding: 13px 14px;
}

.log-summary .metric strong {
  font-size: 24px;
}

.log-summary .metric span {
  color: var(--navy);
  font-size: 13px;
  line-height: 1.25;
  text-transform: none;
}

.muted-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.locked-value {
  color: var(--muted);
  display: inline-block;
  font-weight: 900;
  min-width: 90px;
  padding: 7px 0;
}

body[data-theme="dark"].admin-page {
  background:
    radial-gradient(circle at 10% 4%, rgba(114, 242, 30, 0.12), transparent 26rem),
    radial-gradient(circle at 90% 2%, rgba(39, 213, 230, 0.14), transparent 30rem),
    linear-gradient(135deg, #061b24, #092b38 58%, #031119);
}

body[data-theme="dark"] .admin-header,
body[data-theme="dark"] .admin-card,
body[data-theme="dark"] .admin-stat,
body[data-theme="dark"].admin-page .table-panel {
  background: rgba(8, 34, 46, 0.92);
  border-color: rgba(137, 214, 220, 0.22);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .admin-logo {
  background: #ffffff;
  border-color: rgba(137, 214, 220, 0.22);
}

body[data-theme="dark"] .admin-nav .sidebar-link,
body[data-theme="dark"] .role-list dt,
body[data-theme="dark"] .locked-value {
  color: var(--navy);
}

body[data-theme="dark"] .admin-card h2,
body[data-theme="dark"] .table-head h3,
body[data-theme="dark"] .admin-header h1,
body[data-theme="dark"] .admin-stat strong {
  color: var(--ink);
}

body[data-theme="dark"] .secondary-action,
body[data-theme="dark"] .table-action {
  background: rgba(13, 49, 62, 0.92);
  border-color: rgba(137, 214, 220, 0.28);
  color: var(--ink);
}

body[data-theme="dark"] .log-toolbar {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(137, 214, 220, 0.24);
}

body[data-theme="dark"] .log-chip {
  background: rgba(39, 213, 230, 0.1);
  border-color: rgba(137, 214, 220, 0.24);
  color: var(--ink);
}

body[data-theme="dark"] .log-chip.is-active {
  background: #20b7c5;
  border-color: #20b7c5;
  color: #062936;
}

body[data-theme="dark"] .danger-action {
  background: rgba(217, 45, 32, 0.18);
  color: #ffb4ad;
}

body[data-theme="dark"] .flash.success {
  background: rgba(34, 229, 139, 0.14);
  color: #9cf2c8;
}

body[data-theme="dark"] .session-box {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(137, 214, 220, 0.2);
}

/* Platform shell: module menu and administration share the auditor language. */
.modules-page {
  background:
    radial-gradient(circle at 7% 2%, rgba(114, 242, 30, 0.24), transparent 28rem),
    radial-gradient(circle at 82% 9%, rgba(24, 183, 213, 0.22), transparent 34rem),
    linear-gradient(135deg, #f7fffb, #eefaf8 52%, #eef8ff);
  display: block;
  min-height: 100vh;
}

.modules-page .module-shell {
  margin: 0 auto;
  max-width: 1320px;
  padding: 26px;
}

.modules-page .module-header {
  background:
    radial-gradient(circle at 3% 0, rgba(114, 242, 30, 0.16), transparent 18rem),
    radial-gradient(circle at 98% 0, rgba(24, 183, 213, 0.16), transparent 22rem),
    linear-gradient(135deg, #ffffff, #f7fcfd);
  border-radius: 26px;
  box-shadow: 0 28px 70px rgba(7, 89, 122, 0.16);
  padding: 24px;
}

.modules-page .module-brand-block {
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.modules-page .module-logo,
.module-logo.wide-logo {
  background: #ffffff;
  border: 1px solid rgba(205, 232, 229, 0.9);
  border-radius: 20px;
  box-shadow: 0 18px 42px rgba(7, 89, 122, 0.2), inset 0 0 0 1px rgba(7, 89, 122, 0.04);
  height: auto;
  max-height: none;
  max-width: 260px;
  min-width: 0;
  object-fit: contain;
  padding: 12px 16px;
  width: clamp(210px, 17vw, 250px);
}

.modules-page .module-header h1 {
  font-size: clamp(34px, 4vw, 50px);
  letter-spacing: -0.06em;
  line-height: 0.92;
}

.module-session-pill {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(7, 89, 122, 0.12);
  color: var(--ink);
  font-weight: 900;
  max-width: 260px;
  overflow: hidden;
  padding: 9px 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modules-page .theme-toggle,
.admin-page .theme-toggle,
.module-nav-link,
.admin-nav .sidebar-link,
.modules-page .secondary-action,
.admin-page .secondary-action {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  justify-content: center;
  min-height: 48px;
  padding: 10px 20px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
  width: 100%;
}

.modules-page .theme-toggle,
.admin-page .theme-toggle,
.module-nav-link,
.admin-nav .sidebar-link {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(205, 232, 229, 0.95);
  box-shadow: 0 16px 34px rgba(7, 89, 122, 0.14);
  color: #083444;
  text-decoration: none;
}

.module-nav-link,
.admin-nav .sidebar-link {
  background: linear-gradient(135deg, #ffffff, #ecfbff);
  color: #07597a;
}

.module-nav form,
.admin-nav form {
  margin: 0;
  width: 100%;
}

.modules-page .module-nav {
  align-items: center;
  gap: 12px;
  max-width: 560px;
}

.modules-page .module-nav .theme-toggle,
.modules-page .module-nav .module-nav-link,
.modules-page .module-nav form,
.admin-page .admin-nav .theme-toggle,
.admin-page .admin-nav .sidebar-link,
.admin-page .admin-nav form {
  flex: 0 0 172px;
  width: 172px;
}

.modules-page .module-session-pill {
  flex: 1 1 100%;
  margin-left: auto;
  max-width: 360px;
}

.modules-page .secondary-action,
.admin-page .secondary-action {
  background: linear-gradient(135deg, #07597a, #18b7d5);
  border: 0;
  box-shadow: 0 18px 38px rgba(7, 89, 122, 0.22);
  color: #ffffff;
}

.modules-page .theme-toggle:hover,
.admin-page .theme-toggle:hover,
.module-nav-link:hover,
.admin-nav .sidebar-link:hover,
.modules-page .secondary-action:hover,
.admin-page .secondary-action:hover,
.module-card-action:hover {
  box-shadow: 0 22px 48px rgba(7, 89, 122, 0.22);
  transform: translateY(-2px);
}

.admin-nav .secondary-action {
  width: 100%;
}

.module-overview {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  margin-bottom: 18px;
}

.module-overview-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  min-height: 86px;
  padding: 14px 16px;
}

.module-overview-card strong {
  display: block;
  font-size: 27px;
  letter-spacing: -0.05em;
  line-height: 1;
}

.module-overview-card span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 900;
  margin-top: 8px;
  text-transform: uppercase;
}

.module-section-head {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin: 26px 0 14px;
}

.module-section-head h2,
.module-section-head h3 {
  font-size: 24px;
  letter-spacing: -0.04em;
  margin: 6px 0 0;
}

.module-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.module-card {
  border-radius: 24px;
  box-shadow: 0 22px 52px rgba(7, 89, 122, 0.12);
  min-height: 280px;
  overflow: hidden;
  position: relative;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.module-card::before {
  background: linear-gradient(180deg, #07597a, #18b7d5);
  content: "";
  inset: 0 auto 0 0;
  position: absolute;
  width: 5px;
}

.module-card.is-ready {
  background:
    radial-gradient(circle at 100% 0, rgba(10, 223, 120, 0.16), transparent 18rem),
    linear-gradient(135deg, #ffffff, #f8fffd);
}

.module-card.is-soon {
  background:
    radial-gradient(circle at 100% 0, rgba(24, 183, 213, 0.12), transparent 18rem),
    linear-gradient(135deg, #ffffff, #f7fbfd);
}

.module-card.is-ready:hover {
  border-color: rgba(10, 223, 120, 0.64);
  box-shadow: 0 28px 68px rgba(7, 89, 122, 0.18);
  transform: translateY(-2px);
}

.module-card-top,
.module-card-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.module-code,
.module-card-meta span {
  background: rgba(7, 89, 122, 0.08);
  border: 1px solid rgba(7, 89, 122, 0.12);
  border-radius: 999px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 900;
  padding: 5px 9px;
}

.module-card-meta {
  justify-content: flex-start;
  margin-top: auto;
}

.module-card-action {
  background: linear-gradient(135deg, #72f21e, #0adf78 55%, #18b7d5);
  border-radius: 999px;
  box-shadow: 0 18px 38px rgba(10, 180, 120, 0.24);
  color: #082017;
  display: inline-flex;
  font-size: 15px;
  font-weight: 900;
  justify-content: center;
  min-height: 48px;
  padding: 13px 18px;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  width: max-content;
}

.module-card-action.is-disabled {
  background: #eef3f6;
  color: var(--muted);
  cursor: not-allowed;
  pointer-events: none;
}

.admin-page {
  background:
    radial-gradient(circle at 7% 2%, rgba(114, 242, 30, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 9%, rgba(24, 183, 213, 0.18), transparent 34rem),
    linear-gradient(135deg, #f7fffb, #eefaf8 52%, #eef8ff);
}

.admin-shell {
  max-width: 1560px;
  padding: 18px;
}

.admin-header {
  background:
    radial-gradient(circle at 3% 0, rgba(114, 242, 30, 0.14), transparent 18rem),
    radial-gradient(circle at 98% 0, rgba(24, 183, 213, 0.14), transparent 22rem),
    linear-gradient(135deg, #ffffff, #f7fcfd);
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(7, 89, 122, 0.16);
  padding: 24px;
}

.admin-logo {
  background: #ffffff;
  border: 1px solid rgba(205, 232, 229, 0.9);
  border-radius: 20px;
  box-shadow: 0 20px 46px rgba(7, 89, 122, 0.18), inset 0 0 0 1px rgba(7, 89, 122, 0.04);
  padding: 10px 14px;
  width: 260px;
}

.admin-header h1 {
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 0.96;
}

.admin-nav {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-nav a[href="/auditor"],
.admin-nav a[href*="/auditor"] {
  display: none !important;
}

.admin-overview {
  gap: 14px;
}

.admin-stat {
  border-left: 0;
  border-radius: 22px;
  box-shadow: var(--shadow);
  min-height: 96px;
}

.admin-stat::before {
  background: linear-gradient(180deg, #07597a, #18b7d5);
  border-radius: 999px;
  content: "";
  display: block;
  height: 4px;
  margin-bottom: 12px;
  width: 42px;
}

.admin-card,
.admin-page .table-panel {
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.admin-card {
  padding: 20px;
}

.admin-card h2,
.table-head h3 {
  letter-spacing: -0.04em;
}

.role-list div {
  background: rgba(24, 183, 213, 0.06);
  border-left: 4px solid var(--cyan);
  border-radius: 14px;
  padding: 10px 12px;
}

.admin-page .table-wrap {
  border-radius: 16px;
}

.log-toolbar {
  border-radius: 18px;
}

.log-chip {
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.log-chip:hover {
  transform: translateY(-1px);
}

body[data-theme="dark"].modules-page {
  background:
    radial-gradient(circle at 8% 3%, rgba(114, 242, 30, 0.18), transparent 28rem),
    radial-gradient(circle at 85% 8%, rgba(24, 183, 213, 0.18), transparent 34rem),
    linear-gradient(135deg, #061b24, #092b38 55%, #031119);
}

body[data-theme="dark"] .module-overview-card,
body[data-theme="dark"] .module-card,
body[data-theme="dark"] .admin-header,
body[data-theme="dark"] .admin-card,
body[data-theme="dark"] .admin-stat,
body[data-theme="dark"].admin-page .table-panel {
  background: rgba(8, 34, 46, 0.92);
  border-color: rgba(137, 214, 220, 0.22);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .modules-page .module-header,
body[data-theme="dark"] .admin-header {
  background:
    radial-gradient(circle at 4% 0, rgba(114, 242, 30, 0.12), transparent 18rem),
    radial-gradient(circle at 98% 0, rgba(39, 213, 230, 0.12), transparent 22rem),
    rgba(8, 34, 46, 0.92);
}

body[data-theme="dark"] .module-logo.wide-logo,
body[data-theme="dark"] .modules-page .module-logo,
body[data-theme="dark"] .admin-logo {
  background: #ffffff;
  border-color: rgba(137, 214, 220, 0.22);
}

body[data-theme="dark"] .module-card.is-ready,
body[data-theme="dark"] .module-card.is-soon {
  background:
    radial-gradient(circle at 100% 0, rgba(39, 213, 230, 0.1), transparent 18rem),
    rgba(8, 34, 46, 0.92);
}

body[data-theme="dark"] .module-code,
body[data-theme="dark"] .module-card-meta span {
  background: rgba(39, 213, 230, 0.1);
  border-color: rgba(137, 214, 220, 0.24);
  color: var(--ink);
}

body[data-theme="dark"] .module-card-action.is-disabled {
  background: rgba(255, 255, 255, 0.14);
  color: #d7edf2;
}

body[data-theme="dark"] .modules-page .module-card-action {
  background: linear-gradient(135deg, #b5ff62, #32e58f 58%, #42d7e6);
  border: 1px solid rgba(204, 255, 221, 0.34);
  box-shadow: 0 20px 42px rgba(34, 229, 139, 0.26);
  color: #062216;
  text-shadow: none;
}

body[data-theme="dark"] .modules-page .module-card-action.is-disabled {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(137, 214, 220, 0.2);
  box-shadow: none;
  color: #d7edf2;
}

body[data-theme="dark"] .module-session-pill,
body[data-theme="dark"] .admin-nav .sidebar-link,
body[data-theme="dark"] .modules-page .theme-toggle,
body[data-theme="dark"] .admin-page .theme-toggle,
body[data-theme="dark"] .module-nav-link {
  background: rgba(13, 49, 62, 0.96);
  border-color: rgba(137, 214, 220, 0.28);
  color: #f4feff;
}

body[data-theme="dark"] .modules-page .secondary-action,
body[data-theme="dark"] .admin-page .secondary-action {
  background: linear-gradient(135deg, #20b7c5, #22e58b);
  color: #062936;
}

@media (max-width: 1180px) {
  .modules-page {
    display: block;
  }

}

@media (max-width: 720px) {
  .modules-page .module-header,
  .modules-page .module-brand-block,
  .modules-page .module-nav {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .modules-page .module-nav {
    max-width: none;
  }

  .modules-page .module-nav .theme-toggle,
  .modules-page .module-nav .module-nav-link,
  .modules-page .module-nav form,
  .admin-page .admin-nav .theme-toggle,
  .admin-page .admin-nav .sidebar-link,
  .admin-page .admin-nav form {
    flex-basis: auto;
    width: 100%;
  }

  .module-section-head {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .module-overview {
    grid-template-columns: 1fr;
  }

  .module-logo.wide-logo,
  .modules-page .module-logo,
  .admin-logo {
    max-width: 280px;
    min-width: 0;
    width: 100%;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .admin-grid,
  .admin-header,
  .admin-nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-brand-block {
    align-items: start;
    display: grid;
  }

  .admin-logo {
    max-width: 220px;
    width: 100%;
  }

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

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

@media (max-width: 560px) {
  .admin-shell {
    padding: 16px;
  }

  .admin-overview,
  .log-summary {
    grid-template-columns: 1fr;
  }

  .log-toolbar {
    grid-template-columns: 1fr;
  }

  .log-actions {
    justify-content: stretch;
  }

  .log-actions .table-action {
    width: 100%;
  }
}

/* Auditor filters: keep the checkbox from inheriting full input sizing. */
.search-panel .filters {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.search-panel .filters input,
.search-panel .filters select,
.search-panel .filters .check {
  min-height: 58px;
  min-width: 0;
  width: 100%;
}

.search-panel .filters #cargo {
  grid-column: span 2;
}

.search-panel .filters #estado {
  grid-column: span 1;
  min-width: 0;
}

.search-panel .filters .check {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 18px minmax(0, 1fr);
  justify-content: start;
}

.search-panel .filters .check input[type="checkbox"] {
  accent-color: #0bb47b;
  appearance: auto;
  box-shadow: none;
  cursor: pointer;
  height: 18px;
  margin: 0;
  min-height: 18px;
  padding: 0;
  width: 18px;
}

.search-panel .filters .check span {
  display: block;
  line-height: 1.15;
  min-width: 0;
}

body[data-theme="dark"] .search-panel .filters .check input[type="checkbox"] {
  accent-color: #32e58f;
  background: transparent;
  border-color: rgba(137, 214, 220, 0.42);
}

@media (max-width: 1180px) {
  .search-panel .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-panel .filters #cargo {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .search-panel .filters {
    grid-template-columns: 1fr;
  }

  .search-panel .filters #cargo,
  .search-panel .filters #estado {
    grid-column: auto;
  }
}

/* Auditor header: keep the top actions aligned in light and dark themes. */
.workspace .topbar {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  min-width: 0;
}

.workspace .topbar > div:first-child {
  flex: 1 1 420px;
  min-width: 0;
}

.workspace .topbar h2 {
  max-width: 920px;
}

.workspace .top-actions {
  align-items: center;
  display: flex;
  flex: 1 1 640px;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: end;
  max-width: 100%;
  min-width: 0;
}

.workspace .top-actions .top-module-link {
  flex: 0 1 210px;
}

.workspace .top-actions .user-menu {
  flex: 0 1 250px;
}

.workspace .top-actions .theme-toggle {
  flex: 0 1 150px;
}

.workspace .top-actions .status {
  flex: 0 1 300px;
}

.workspace .top-actions .top-module-link,
.workspace .top-actions .user-menu,
.workspace .top-actions .theme-toggle,
.workspace .top-actions .status {
  min-width: 0;
}

.workspace .top-actions .top-module-link,
.workspace .top-actions .user-menu summary,
.workspace .top-actions .theme-toggle,
.workspace .top-actions .status {
  align-items: center;
  background:
    radial-gradient(circle at 100% 0, rgba(24, 183, 213, 0.12), transparent 9rem),
    rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(7, 89, 122, 0.12);
  color: var(--ink);
  display: flex;
  font-weight: 900;
  justify-content: center;
  min-height: 48px;
  padding: 10px 14px;
  text-align: center;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

.workspace .top-actions .user-menu summary {
  width: 100%;
}

.workspace .top-actions .top-module-link {
  background:
    linear-gradient(135deg, rgba(114, 242, 30, 0.9), rgba(24, 183, 213, 0.88));
  border-color: rgba(24, 183, 213, 0.62);
  color: #062735;
  box-shadow:
    0 16px 34px rgba(7, 89, 122, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.workspace .top-actions .top-module-link,
.workspace .top-actions .user-menu summary,
.workspace .top-actions .theme-toggle {
  cursor: pointer;
}

.workspace .top-actions .status {
  cursor: default;
}

.workspace .top-actions .user-menu summary:hover,
.workspace .top-actions .top-module-link:hover,
.workspace .top-actions .theme-toggle:hover {
  border-color: rgba(24, 183, 213, 0.62);
  box-shadow: 0 22px 48px rgba(7, 89, 122, 0.2);
  transform: translateY(-2px);
}

.workspace .top-actions .user-menu[open] summary {
  border-color: rgba(10, 223, 120, 0.58);
  box-shadow: 0 22px 52px rgba(10, 160, 120, 0.18);
}

.workspace .top-actions .theme-toggle:focus-visible,
.workspace .top-actions .top-module-link:focus-visible,
.workspace .top-actions .user-menu summary:focus-visible {
  outline: 3px solid rgba(34, 229, 139, 0.38);
  outline-offset: 3px;
}

.workspace .top-actions .user-menu summary span,
.workspace .top-actions .top-module-link,
.workspace .top-actions .status {
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace .top-actions .theme-toggle {
  line-height: 1.1;
}

.workspace .top-actions .status {
  background:
    radial-gradient(circle at 100% 0, rgba(24, 183, 213, 0.08), transparent 9rem),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(7, 89, 122, 0.08);
  display: block;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: none;
}

.workspace .top-actions .status::before {
  content: none;
}

@media (max-width: 1480px) {
  .workspace .top-actions {
    justify-content: start;
  }
}

@media (max-width: 820px) {
  .workspace .top-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }
}

body[data-theme="dark"] .workspace .top-actions .user-menu summary,
body[data-theme="dark"] .workspace .top-actions .theme-toggle,
body[data-theme="dark"] .workspace .top-actions .status {
  background:
    radial-gradient(circle at 100% 0, rgba(39, 213, 230, 0.12), transparent 9rem),
    rgba(9, 38, 51, 0.94);
  border-color: rgba(137, 214, 220, 0.34);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
  color: #f4feff;
}

body[data-theme="dark"] .workspace .top-actions .top-module-link {
  background:
    linear-gradient(135deg, rgba(114, 242, 30, 0.92), rgba(24, 183, 213, 0.9));
  border-color: rgba(34, 229, 139, 0.62);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
  color: #042734;
}

body[data-theme="dark"] .workspace .top-actions .user-menu summary:hover,
body[data-theme="dark"] .workspace .top-actions .top-module-link:hover,
body[data-theme="dark"] .workspace .top-actions .theme-toggle:hover {
  border-color: rgba(39, 213, 230, 0.56);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.38);
}

body[data-theme="dark"] .workspace .top-actions .user-menu[open] summary {
  border-color: rgba(34, 229, 139, 0.48);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"] .workspace .top-actions .user-menu summary::after {
  color: #a7c2ca;
}

body[data-theme="dark"] .workspace .top-actions .status {
  background:
    radial-gradient(circle at 100% 0, rgba(39, 213, 230, 0.08), transparent 9rem),
    rgba(9, 38, 51, 0.72);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

/* Accounting unifier: a dedicated reconciliation workbench, not another auditor table. */
body.accounting-page {
  background:
    linear-gradient(90deg, rgba(7, 89, 122, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(7, 89, 122, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 88% 5%, rgba(24, 183, 213, 0.18), transparent 30rem),
    radial-gradient(circle at 12% 8%, rgba(114, 242, 30, 0.16), transparent 24rem),
    linear-gradient(135deg, #f7fffb, #eefaf8 52%, #eef8ff);
  background-size: 34px 34px, 34px 34px, auto, auto, auto;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.accounting-rail {
  background:
    linear-gradient(180deg, rgba(7, 89, 122, 0.97), rgba(5, 55, 75, 0.98)),
    radial-gradient(circle at 20% 0, rgba(114, 242, 30, 0.2), transparent 18rem);
  color: #f6fffb;
  display: grid;
  gap: 18px;
  grid-template-rows: auto auto auto 1fr;
  min-height: 100vh;
  padding: 22px;
  position: sticky;
  top: 0;
}

.accounting-logo,
.accounting-import,
.accounting-rule {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(205, 232, 229, 0.3);
  border-radius: 18px;
}

.accounting-logo {
  background: #ffffff;
  display: block;
  padding: 10px 14px;
  width: 100%;
}

.accounting-rail-title span,
.accounting-rule span,
.accounting-import > label {
  color: #c8ffe7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.accounting-rail-title h1 {
  color: #ffffff;
  font-size: 34px;
  letter-spacing: -0.055em;
  line-height: 0.95;
  margin: 10px 0;
}

.accounting-rail-title p,
.accounting-rule p,
.accounting-import p,
.accounting-import small {
  color: rgba(241, 255, 251, 0.82);
  line-height: 1.45;
}

.accounting-import-intro {
  font-size: 13px;
  font-weight: 750;
  margin: -2px 0 2px;
}

.accounting-import,
.accounting-rule {
  display: grid;
  gap: 10px;
  padding: 15px;
}

.accounting-file {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid rgba(205, 232, 229, 0.68);
  border-radius: 14px;
  color: #113341;
  cursor: pointer;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.accounting-file:hover,
.accounting-file.has-file {
  border-color: rgba(10, 223, 120, 0.72);
  box-shadow: 0 12px 24px rgba(3, 42, 55, 0.12);
  transform: translateY(-1px);
}

.accounting-file span {
  color: #07597a;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.accounting-file strong {
  color: #12394b;
  display: block;
  font-size: 13px;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-file-pair,
.accounting-rule-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.accounting-file-pair .accounting-file {
  min-width: 0;
}

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

.system-check {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(205, 232, 229, 0.24);
  border-radius: 999px;
  color: rgba(246, 255, 251, 0.8);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  text-align: center;
}

.system-check.is-ready {
  background: rgba(114, 242, 30, 0.16);
  border-color: rgba(114, 242, 30, 0.48);
  color: #dcffe9;
}

.accounting-download-card {
  background: linear-gradient(135deg, #72f21e, #0adf78 58%, #18b7d5);
  border-radius: 16px;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
  color: #06261b;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  text-align: center;
  text-decoration: none;
}

.accounting-download-card span {
  font-weight: 950;
}

.accounting-download-card small {
  color: rgba(6, 38, 27, 0.72);
  font-size: 12px;
  font-weight: 850;
}

.accounting-download-card.is-disabled {
  filter: grayscale(0.35);
  opacity: 0.55;
  pointer-events: none;
}

.source-current {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(205, 232, 229, 0.18);
  border-radius: 12px;
  display: block;
  font-size: 12px;
  font-weight: 750;
  margin-top: 1px;
  max-width: 100%;
  overflow: hidden;
  padding: 9px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-rule strong {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(205, 232, 229, 0.26);
  border-radius: 12px;
  color: #ffffff;
  font-size: 13px;
  padding: 10px 12px;
}

.accounting-workbench {
  min-width: 0;
  padding: 22px;
}

.accounting-hero,
.accounting-lanes,
.accounting-ledger {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.accounting-hero {
  align-items: center;
  background:
    radial-gradient(circle at 100% 0, rgba(10, 223, 120, 0.14), transparent 18rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 252, 253, 0.94));
  border-radius: 24px;
  display: flex;
  gap: 22px;
  justify-content: space-between;
  padding: 22px;
}

.accounting-hero h2 {
  font-size: clamp(30px, 3.8vw, 48px);
  letter-spacing: -0.06em;
  line-height: 0.92;
  margin: 8px 0 6px;
}

.accounting-hero span {
  color: var(--muted);
  font-weight: 800;
}

.accounting-actions {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  max-width: 100%;
  width: min(560px, 100%);
}

.accounting-actions .top-module-link,
.accounting-actions .download-accounting-link,
.accounting-actions .theme-toggle,
.accounting-actions .status,
.accounting-actions .user-menu summary {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(7, 89, 122, 0.12);
  color: var(--ink);
  display: flex;
  font-weight: 900;
  justify-content: center;
  min-height: 48px;
  overflow: hidden;
  padding: 10px 14px;
  text-align: center;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.download-accounting-link.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.accounting-actions .status {
  grid-column: 1 / -1;
}

.accounting-actions .user-menu {
  min-width: 0;
  width: 100%;
}

.accounting-actions .user-menu summary {
  width: 100%;
}

.accounting-actions .user-menu summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-ledger-strip {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 18px 0;
}

.accounting-ledger-strip .metric {
  border-radius: 16px;
  box-shadow: 0 16px 34px rgba(7, 89, 122, 0.1);
  min-height: 82px;
}

.accounting-lanes {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.accounting-lane {
  background: rgba(255, 255, 255, 0.8);
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
}

.accounting-lane span {
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.accounting-lane strong {
  font-size: 34px;
  letter-spacing: -0.055em;
  line-height: 1;
}

.accounting-lane p {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.35;
  margin: 0;
}

.accounting-lane.lane-center {
  background: linear-gradient(135deg, #07597a, #0a6f92 52%, #0bb47b);
  color: #ffffff;
}

.accounting-lane.lane-center span,
.accounting-lane.lane-center p {
  color: rgba(246, 255, 251, 0.82);
}

.accounting-ledger {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  padding: 16px;
}

.accounting-ledger-head {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.accounting-ledger-head h3 {
  font-size: 24px;
  letter-spacing: -0.04em;
  margin: 6px 0 0;
}

.accounting-row-counter-hidden {
  display: none;
}

.accounting-table-search {
  background:
    linear-gradient(135deg, rgba(246, 252, 253, 0.96), rgba(230, 245, 246, 0.82));
  border: 1px solid rgba(7, 89, 122, 0.14);
  border-radius: 18px 18px 0 0;
  margin-bottom: 0;
  padding: 12px;
}

.accounting-table-search input {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  width: 100%;
  min-height: 48px;
}

.accounting-page .table-tools {
  display: none !important;
}

.accounting-page .accounting-filters {
  display: none !important;
}

.accounting-status-guide {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(232, 247, 246, 0.86)),
    radial-gradient(circle at 100% 0, rgba(10, 223, 120, 0.12), transparent 18rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  margin: 16px 0;
  padding: 16px;
}

.status-guide-title h3 {
  font-size: 22px;
  letter-spacing: -0.04em;
  margin: 6px 0 0;
}

.status-guide-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.status-guide-grid article {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(205, 232, 229, 0.82);
  border-radius: 16px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.status-guide-grid p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

.accounting-workbook-tabs {
  background: #111111;
  border: 1px solid #2a2a2a;
  border-radius: 0 0 10px 10px;
  display: block;
  margin-top: -1px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  scrollbar-color: #8f8f8f #151515;
  scrollbar-width: thin;
}

.accounting-workbook-tabs::-webkit-scrollbar {
  height: 9px;
}

.accounting-workbook-tabs::-webkit-scrollbar-track {
  background: #151515;
}

.accounting-workbook-tabs::-webkit-scrollbar-thumb {
  background: #8f8f8f;
  border: 2px solid #151515;
  border-radius: 999px;
}

.workbook-tab-strip {
  align-items: flex-end;
  display: flex;
  justify-content: flex-start;
  min-width: 100%;
  overflow: visible;
  white-space: nowrap;
  width: max-content;
}

.accounting-sheet-tabs {
  align-items: stretch;
  display: flex;
  flex: 0 0 auto;
  gap: 0;
  justify-content: flex-start;
  min-width: max-content;
  width: max-content;
}

.sheet-tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-left: 1px solid #444444;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #f2f2f2;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
  min-height: 34px;
  padding: 7px 18px 6px;
  text-transform: none;
  width: auto;
}

.sheet-tab.is-active {
  background: #ffffff;
  border-bottom-color: #25a366;
  box-shadow: none;
  color: #111111;
}

.workbook-nav,
.workbook-plus,
.workbook-menu {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #f2f2f2;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  min-height: 34px;
  opacity: 0.9;
  padding: 0 9px;
  width: auto;
}

.workbook-plus {
  border-left: 1px solid #3a3a3a;
  color: #f2f2f2;
}

.workbook-scroll-track {
  display: none;
}

.workbook-scroll-track span {
  background: #9a9a9a;
  border-radius: 999px;
  display: block;
  height: 6px;
  width: min(520px, 42%);
}

.accounting-table-frame {
  background: #ffffff;
  border: 1px solid #b8d0da;
  border-radius: 10px 10px 0 0;
  max-height: clamp(360px, 68vh, 760px);
  min-height: 220px;
  overflow: auto;
  scrollbar-color: #7f9ead #edf5f7;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.accounting-table-frame::-webkit-scrollbar {
  height: 11px;
  width: 11px;
}

.accounting-table-frame::-webkit-scrollbar-track {
  background: #edf5f7;
}

.accounting-table-frame::-webkit-scrollbar-thumb {
  background: #7f9ead;
  border: 2px solid #edf5f7;
  border-radius: 999px;
}

.accounting-table {
  border-collapse: collapse;
  min-width: 1780px;
  width: max-content;
}

.accounting-table td,
.accounting-table th {
  border: 1px solid #d7e3e8;
  font-size: 12px;
  padding: 4px 6px;
  vertical-align: top;
  white-space: nowrap;
}

.accounting-table th {
  position: sticky;
  z-index: 3;
}

.accounting-table thead tr:first-child th {
  top: 0;
}

.excel-column-letter,
.excel-corner {
  background: #0b0b0b;
  color: #ffffff;
  font-weight: 700;
  height: 26px;
  padding: 3px 6px;
  text-align: center;
}

.excel-field-header {
  background: #ffffff;
  color: #111111;
  font-weight: 500;
  height: 24px;
}

.accounting-table td {
  background: #ffffff;
  color: #000000;
  font-weight: 500;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accounting-table tr:nth-child(even) td {
  background: #ffffff;
}

.excel-row-number {
  background: #111111 !important;
  color: #f4f4f4 !important;
  font-weight: 700 !important;
  left: 0;
  min-width: 34px;
  position: sticky;
  text-align: center;
  width: 34px;
  z-index: 4;
}

.accounting-table tbody .excel-row-number {
  z-index: 2;
}

.excel-corner {
  left: 0;
  min-width: 34px;
  position: sticky;
  width: 34px;
  z-index: 5;
}

.system-chip {
  border-radius: 999px;
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  padding: 4px 8px;
}

.system-chip.SIESA {
  background: #bfe8ff;
  border: 1px solid #6ba9c8;
  color: #06384d;
}

.system-chip.AQUILA {
  background: #c7f5db;
  border: 1px solid #70bc8b;
  color: #06472a;
}

.accounting-page tr.MATCH_EXACTO td {
  background: #f3fff8;
}

.accounting-page tr.MATCH_PARCIAL td,
.accounting-page tr.SIN_CONSECUTIVO td,
.accounting-page tr.AQUILA_NO_FACTURADO td,
.accounting-page tr.MEDICO_FALTANTE td {
  background: #fff9e8;
}

.accounting-page tr.AMBIGUO td,
.accounting-page tr.DUPLICADO td {
  background: #fff0ee;
}

body[data-theme="dark"].accounting-page {
  background:
    linear-gradient(90deg, rgba(137, 214, 220, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(137, 214, 220, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 85% 8%, rgba(39, 213, 230, 0.16), transparent 30rem),
    linear-gradient(135deg, #061b24, #092b38 55%, #031119);
  background-size: 34px 34px, 34px 34px, auto, auto;
}

body[data-theme="dark"].accounting-page .accounting-hero,
body[data-theme="dark"].accounting-page .accounting-ledger,
body[data-theme="dark"].accounting-page .accounting-status-guide,
body[data-theme="dark"].accounting-page .accounting-lanes,
body[data-theme="dark"].accounting-page .accounting-lane {
  background: rgba(8, 34, 46, 0.92);
  border-color: rgba(137, 214, 220, 0.22);
}

body[data-theme="dark"].accounting-page .status-guide-grid article {
  background: rgba(16, 54, 68, 0.84);
  border-color: rgba(137, 214, 220, 0.22);
}

body[data-theme="dark"].accounting-page .status-guide-grid p {
  color: #b6cbd2;
}

body[data-theme="dark"].accounting-page .accounting-lane.lane-center {
  background: linear-gradient(135deg, #0a4d68, #087960 52%, #0bb47b);
}

body[data-theme="dark"].accounting-page .accounting-actions .top-module-link,
body[data-theme="dark"].accounting-page .accounting-actions .download-accounting-link,
body[data-theme="dark"].accounting-page .accounting-actions .theme-toggle,
body[data-theme="dark"].accounting-page .accounting-actions .status,
body[data-theme="dark"].accounting-page .accounting-actions .user-menu summary {
  background: rgba(9, 38, 51, 0.94);
  border-color: rgba(137, 214, 220, 0.3);
  color: #f4feff;
}

body[data-theme="dark"].accounting-page .accounting-table-search {
  background:
    linear-gradient(135deg, rgba(9, 38, 51, 0.96), rgba(12, 58, 72, 0.82));
  border-color: rgba(137, 214, 220, 0.24);
}

body[data-theme="dark"].accounting-page .accounting-file {
  background: rgba(247, 252, 253, 0.95);
  color: #113341;
}

body[data-theme="dark"].accounting-page .accounting-file strong {
  color: #12394b;
}

body[data-theme="dark"].accounting-page .system-chip.SIESA {
  background: #bfe8ff;
  border: 1px solid #6ba9c8;
  color: #06384d;
}

body[data-theme="dark"].accounting-page .system-chip.AQUILA {
  background: #c7f5db;
  border: 1px solid #70bc8b;
  color: #06472a;
}

body[data-theme="dark"].accounting-page tr.MATCH_EXACTO td {
  background: rgba(21, 88, 63, 0.72);
  color: #ecfff5;
}

body[data-theme="dark"].accounting-page tr.MATCH_PARCIAL td,
body[data-theme="dark"].accounting-page tr.SIN_CONSECUTIVO td,
body[data-theme="dark"].accounting-page tr.AQUILA_NO_FACTURADO td,
body[data-theme="dark"].accounting-page tr.MEDICO_FALTANTE td {
  background: rgba(92, 73, 38, 0.78);
  color: #fff8e8;
}

body[data-theme="dark"].accounting-page tr.AMBIGUO td,
body[data-theme="dark"].accounting-page tr.DUPLICADO td {
  background: rgba(108, 58, 60, 0.78);
  color: #fff3f1;
}

body[data-theme="dark"].accounting-page .accounting-table-frame {
  background: #ffffff;
  border-color: #80a9b8;
}

body[data-theme="dark"].accounting-page .accounting-table th {
  border-color: #c2d8e1;
}

body[data-theme="dark"].accounting-page .accounting-table td {
  background: #ffffff;
  border-color: #d7e3e8;
  color: #18333f;
}

body[data-theme="dark"].accounting-page .accounting-table tr:nth-child(even) td {
  background: #ffffff;
}

body[data-theme="dark"].accounting-page .accounting-table tr.MATCH_EXACTO td {
  background: #f3fff8;
  color: #18333f;
}

body[data-theme="dark"].accounting-page .accounting-table tr.MATCH_PARCIAL td,
body[data-theme="dark"].accounting-page .accounting-table tr.SIN_CONSECUTIVO td,
body[data-theme="dark"].accounting-page .accounting-table tr.AQUILA_NO_FACTURADO td,
body[data-theme="dark"].accounting-page .accounting-table tr.MEDICO_FALTANTE td {
  background: #fff9e8;
  color: #18333f;
}

body[data-theme="dark"].accounting-page .accounting-table tr.AMBIGUO td,
body[data-theme="dark"].accounting-page .accounting-table tr.DUPLICADO td {
  background: #fff0ee;
  color: #18333f;
}

body[data-theme="dark"].accounting-page .accounting-workbook-tabs {
  background: #111111;
  border-color: #2a2a2a;
}

body[data-theme="dark"].accounting-page .sheet-tab {
  background: transparent;
  color: #f2f2f2;
}

body[data-theme="dark"].accounting-page .sheet-tab.is-active {
  background: #ffffff;
  color: #111111;
}

body[data-theme="dark"].accounting-page .excel-column-letter,
body[data-theme="dark"].accounting-page .excel-corner,
body[data-theme="dark"].accounting-page .excel-row-number {
  background: #111111 !important;
  color: #f4f4f4 !important;
}

body[data-theme="dark"].accounting-page .excel-field-header {
  background: #ffffff;
  color: #111111;
}

@media (max-width: 1180px) {
  body.accounting-page {
    display: block;
  }

  .accounting-rail {
    min-height: auto;
    position: static;
  }

  .accounting-hero,
  .accounting-ledger-head {
    align-items: stretch;
    display: grid;
  }

  .accounting-ledger-strip,
  .accounting-lanes,
  .accounting-system-checks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accounting-actions {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }

  .accounting-table-search {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .accounting-workbench,
  .accounting-rail {
    padding: 16px;
  }

  .accounting-actions,
  .accounting-ledger-strip,
  .accounting-lanes,
  .accounting-file-pair,
  .accounting-rule-grid,
  .accounting-system-checks {
    grid-template-columns: 1fr;
  }

  .accounting-actions .status,
  .accounting-actions .user-menu {
    grid-column: auto;
  }

}

@property --status-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes statusGlowBreath {
  0%, 100% {
    opacity: 0.48;
    filter: blur(0.45rem) saturate(0.95) brightness(0.95);
  }
  50% {
    opacity: 0.86;
    filter: blur(0.58rem) saturate(1.25) brightness(1.12);
  }
}

@keyframes statusGlowOrbit {
  to {
    --status-angle: 1turn;
  }
}

.workspace .top-actions .status {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #f4feff;
  display: flex;
  font-weight: 900;
  isolation: isolate;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.workspace .top-actions .status::before,
.workspace .top-actions .status::after {
  border-radius: inherit;
  content: "";
  pointer-events: none;
  position: absolute;
}

.workspace .top-actions .status::before {
  animation: statusGlowBreath 3.4s ease-in-out infinite;
  background:
    conic-gradient(
      from var(--status-angle),
      rgba(7, 89, 122, 0.7),
      rgba(24, 183, 213, 0.92),
      rgba(10, 223, 120, 0.88),
      rgba(114, 242, 30, 0.7),
      rgba(109, 79, 209, 0.8),
      rgba(24, 183, 213, 0.9),
      rgba(7, 89, 122, 0.7)
    );
  inset: -0.5rem;
  z-index: -2;
}

.workspace .top-actions .status::after {
  background: rgba(9, 38, 51, 0.92);
  inset: 3px;
  z-index: -1;
}

.workspace .top-actions .status.is-analyzing {
  box-shadow: 0 14px 36px rgba(34, 229, 139, 0.2), 0 0 0 1px rgba(89, 255, 47, 0.08);
}

.workspace .top-actions .status.is-analyzing::before {
  animation: statusGlowOrbit 2.2s linear infinite;
  opacity: 1;
}

body[data-theme="dark"] .workspace .top-actions .status,
body[data-theme="dark"] .workspace .top-actions .status.is-analyzing {
  background: transparent;
  color: #f4feff;
}

@keyframes buttonThinGlowBreath {
  0%, 100% {
    border-color: rgba(7, 89, 122, 0.36);
    box-shadow:
      0 10px 24px rgba(7, 89, 122, 0.1),
      0 0 0 rgba(24, 183, 213, 0),
      0 0 0 rgba(109, 79, 209, 0);
  }
  50% {
    border-color: rgba(24, 183, 213, 0.72);
    box-shadow:
      0 14px 30px rgba(7, 89, 122, 0.18),
      0 0 0 1px rgba(10, 223, 120, 0.28),
      0 0 18px rgba(24, 183, 213, 0.38),
      0 0 26px rgba(109, 79, 209, 0.18);
  }
}

@keyframes buttonLightGlowBreath {
  0%, 100% {
    border-color: rgba(7, 89, 122, 0.62);
    box-shadow:
      0 10px 24px rgba(7, 89, 122, 0.12),
      0 0 0 1px rgba(7, 89, 122, 0.08),
      0 0 0 rgba(24, 183, 213, 0);
  }
  50% {
    border-color: rgba(7, 89, 122, 0.95);
    box-shadow:
      0 16px 34px rgba(7, 89, 122, 0.22),
      0 0 0 2px rgba(24, 183, 213, 0.42),
      0 0 18px rgba(10, 223, 120, 0.34),
      0 0 28px rgba(109, 79, 209, 0.22);
  }
}

:is(
  button,
  .download,
  .file-picker,
  .theme-toggle,
  .secondary-action,
  .top-module-link,
  .module-nav-link,
  .admin-nav .sidebar-link,
  .module-card-action,
  .page-btn,
  .table-action,
  .log-chip,
  .user-menu summary
):not(.menu-logout):not(.is-disabled) {
  border-color: rgba(137, 214, 220, 0.28);
}

:is(
  button,
  .download,
  .file-picker,
  .theme-toggle,
  .secondary-action,
  .top-module-link,
  .module-nav-link,
  .admin-nav .sidebar-link,
  .module-card-action,
  .page-btn,
  .table-action,
  .log-chip,
  .user-menu summary
):not(.menu-logout):not(.is-disabled):hover,
:is(
  button,
  .download,
  .file-picker,
  .theme-toggle,
  .secondary-action,
  .top-module-link,
  .module-nav-link,
  .admin-nav .sidebar-link,
  .module-card-action,
  .page-btn,
  .table-action,
  .log-chip,
  .user-menu summary
):not(.menu-logout):not(.is-disabled):focus-visible {
  animation: buttonThinGlowBreath 2.2s ease-in-out infinite;
}

:is(button:disabled, .page-btn:disabled, .module-card-action.is-disabled) {
  animation: none;
}

body[data-theme="dark"] :is(
  button,
  .download,
  .file-picker,
  .theme-toggle,
  .secondary-action,
  .top-module-link,
  .module-nav-link,
  .admin-nav .sidebar-link,
  .module-card-action,
  .page-btn,
  .table-action,
  .log-chip,
  .user-menu summary
):not(.menu-logout):not(.is-disabled) {
  border-color: rgba(137, 214, 220, 0.32);
}

body:not([data-theme="dark"]) :is(
  .workspace .top-actions .user-menu summary,
  .workspace .top-actions .theme-toggle,
  .workspace .top-actions .top-module-link,
  .modules-page .theme-toggle,
  .admin-page .theme-toggle,
  .module-nav-link,
  .admin-nav .sidebar-link,
  .file-picker,
  .page-btn,
  .table-action,
  .log-chip
):not(.active):not(.is-active):not(.danger-action) {
  background: #ffffff;
  border-color: rgba(7, 89, 122, 0.36);
}

body:not([data-theme="dark"]) :is(
  button,
  .download,
  .file-picker,
  .theme-toggle,
  .secondary-action,
  .top-module-link,
  .module-nav-link,
  .admin-nav .sidebar-link,
  .module-card-action,
  .page-btn,
  .table-action,
  .log-chip,
  .user-menu summary
):not(.menu-logout):not(.is-disabled):hover,
body:not([data-theme="dark"]) :is(
  button,
  .download,
  .file-picker,
  .theme-toggle,
  .secondary-action,
  .top-module-link,
  .module-nav-link,
  .admin-nav .sidebar-link,
  .module-card-action,
  .page-btn,
  .table-action,
  .log-chip,
  .user-menu summary
):not(.menu-logout):not(.is-disabled):focus-visible {
  animation-name: buttonLightGlowBreath;
}

body:not([data-theme="dark"]) .workspace .top-actions .top-module-link,
body[data-theme="dark"] .workspace .top-actions .top-module-link {
  background:
    linear-gradient(135deg, rgba(114, 242, 30, 0.92), rgba(24, 183, 213, 0.9));
  border-color: rgba(34, 229, 139, 0.62);
  box-shadow:
    0 16px 34px rgba(7, 89, 122, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
  color: #042734;
}

body[data-theme="dark"] .workspace .top-actions .top-module-link {
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

body[data-theme="dark"] .workspace .top-actions .status::after {
  background: rgba(9, 38, 51, 0.94);
}

body:not([data-theme="dark"]) .workspace .top-actions .status,
body:not([data-theme="dark"]) .workspace .top-actions .status.is-analyzing {
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(7, 89, 122, 0.18),
    0 0 18px rgba(24, 183, 213, 0.18),
    0 0 24px rgba(10, 223, 120, 0.12);
  color: #083444;
}

body:not([data-theme="dark"]) .workspace .top-actions .status::before {
  background:
    conic-gradient(
      from var(--status-angle),
      rgba(7, 89, 122, 0.36),
      rgba(7, 89, 122, 0.98),
      rgba(24, 183, 213, 0.95),
      rgba(10, 223, 120, 0.82),
      rgba(109, 79, 209, 0.74),
      rgba(24, 183, 213, 0.95),
      rgba(7, 89, 122, 0.36)
    );
  filter: blur(0.34rem) saturate(1.35) brightness(1.08);
  inset: -0.34rem;
  opacity: 0.96;
}

body:not([data-theme="dark"]) .workspace .top-actions .status::after {
  background: #ffffff;
  inset: 3px;
}

body:not([data-theme="dark"]) .workspace .top-actions .status.is-analyzing {
  box-shadow:
    0 0 0 1px rgba(7, 89, 122, 0.22),
    0 0 20px rgba(24, 183, 213, 0.26),
    0 0 30px rgba(10, 223, 120, 0.18);
}
