/* Adaptación de los temas R29.8.2 a la estructura web de V228. */
body[data-xity-theme] {
  --xity-accent: #1d4ed8;
  --xity-bg: #f3f6fb;
  --xity-nav: #f8faff;
  --xity-card: #ffffff;
  --xity-ink: #16243a;
  --xity-secondary: #475569;
  --xity-border: #dce5f0;
  --xity-subtle: #eaf1ff;
}

body[data-xity-theme="turquesa"] {
  --xity-accent: #0e6571;
  --xity-bg: #edf9fa;
  --xity-nav: #f4fbfc;
  --xity-border: #c7e7e8;
  --xity-subtle: #daf0f1;
}

body[data-xity-theme="verde"] {
  --xity-accent: #146641;
  --xity-bg: #eff8f1;
  --xity-nav: #f6fbf7;
  --xity-border: #cfe6d6;
  --xity-subtle: #e0f2e5;
}

body[data-xity-theme="violeta"] {
  --xity-accent: #6544ae;
  --xity-bg: #f5f2fb;
  --xity-nav: #faf7ff;
  --xity-border: #e4dbf5;
  --xity-subtle: #eee5fd;
}

body[data-xity-theme="claro"] {
  --xity-accent: #235da9;
  --xity-bg: #f8fafc;
  --xity-nav: #ffffff;
  --xity-border: #d8e1ed;
  --xity-subtle: #edf2f8;
}

body[data-xity-theme="oscuro"] {
  --xity-accent: #a6d2ff;
  --xity-bg: #111827;
  --xity-nav: #152033;
  --xity-card: #202c40;
  --xity-ink: #f3f7fc;
  --xity-secondary: #c1d1e2;
  --xity-border: #40546e;
  --xity-subtle: #293b55;
}

body[data-xity-theme]:not(.public-v57-body),
body[data-xity-theme] .app-shell,
body[data-xity-theme] .main {
  background: var(--xity-bg) !important;
}

body[data-xity-theme] :is(.sidebar, .sidebar-header, .sidebar-footer, .sidebar .nav) {
  background: var(--xity-nav) !important;
  border-color: var(--xity-border) !important;
}

body[data-xity-theme] :is(.selector-head, .company-row, .company-search, .selector-search, .selector-page .panel, #companySearchEmpty) {
  background: var(--xity-card) !important;
  border-color: var(--xity-border) !important;
  color: var(--xity-ink) !important;
}

.selector-page .company-list > h2 {
  margin: 1rem 0 0;
  font-size: 1.15rem;
}

.selector-page .company-info h3 {
  margin: 0 0 .5rem;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
}

#companySearchEmpty {
  margin: 1rem 0 0;
  padding: .9rem 1.1rem;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #ffffff;
  color: #475569;
  font-weight: 600;
}

#companySearchEmpty[hidden] {
  display: none !important;
}

.table-wrap table tbody th[scope="rowgroup"] {
  position: static;
  top: auto;
  z-index: auto;
  white-space: normal;
  background: #eaf1fb;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0.01em;
  border-top: 1px solid #dbe5f1;
  border-bottom: 1px solid #cbd5e1;
  padding: 10px 12px;
}

body[data-xity-theme] .table-wrap table tbody th[scope="rowgroup"] {
  background: var(--xity-subtle) !important;
  color: var(--xity-ink) !important;
  border-color: var(--xity-border) !important;
}

body[data-xity-theme] :is(.brand-text h1, .breadcrumb-current, .selector-head h1, .company-list > h2, .company-info h3, .ciro-company-head h2, .sidebar .user-card-name, .sidebar .nav-model-title strong) {
  color: var(--xity-ink) !important;
}

body[data-xity-theme] :is(.brand-text p, .breadcrumb-prefix, .sidebar .nav-item, .sidebar .nav-subitem, .sidebar summary, .sidebar .user-company-chip, .sidebar .nav-model-title span, .company-info p, .selector-head p, .selector-page .panel p, :where(#companySearchEmpty), .ciro-company-head p) {
  color: var(--xity-secondary) !important;
}

body[data-xity-theme] .enter-btn {
  color: var(--xity-ink) !important;
}

body[data-xity-theme] .enter-btn:hover {
  color: var(--xity-accent) !important;
}

body[data-xity-theme] .company-switch select {
  background: var(--xity-card) !important;
  color: var(--xity-ink) !important;
  border: 1px solid var(--xity-border) !important;
}

body[data-xity-theme] .sidebar :is(.nav-item, .nav-subitem):is(:hover, .active) {
  color: var(--xity-accent) !important;
  background: var(--xity-subtle) !important;
}

body[data-xity-theme] :is(.sidebar .user-card, .sidebar .nav-model-title, .sidebar .nav-group-title, .sidebar .sidebar-search-input) {
  background: var(--xity-card) !important;
  color: var(--xity-ink) !important;
  border-color: var(--xity-border) !important;
}

body[data-xity-theme] :is(.ciro-company-head, .ciro-sales-panel, .ciro-chart-panel, .ciro-module-card) {
  background: var(--xity-card) !important;
  color: var(--xity-ink) !important;
  border-color: var(--xity-border) !important;
}

body[data-xity-theme] :is(.ciro-chart-panel, .ciro-sales-panel) .panel-head :is(h3, small),
body[data-xity-theme] :is(.ciro-month-row, .ciro-module-card) :is(b, em, strong, small) {
  color: var(--xity-ink) !important;
}

body[data-xity-theme] .ciro-chart-panel .muted,
body[data-xity-theme] .sidebar-search-input::placeholder {
  color: var(--xity-secondary) !important;
}

body[data-xity-theme] .ciro-status.danger {
  background: #fff1f2 !important;
  border-color: #fecdd3 !important;
}

body[data-xity-theme] .ciro-status.danger :is(strong, span, b) {
  color: #9f1239 !important;
}

body[data-xity-theme] .selector-search input {
  background: var(--xity-card) !important;
  color: var(--xity-ink) !important;
}

.xity-appearance {
  color: var(--xity-ink);
}

.xity-appearance[hidden] { display: none; }

.xity-theme-trigger {
  cursor: pointer;
  border: 1px solid var(--xity-border);
  border-radius: 9px;
  padding: 7px 10px;
  background: var(--xity-subtle);
  color: var(--xity-accent);
  font-size: 13px;
  font-weight: 700;
}

.xity-theme-panel {
  position: fixed;
  inset: max(60px, env(safe-area-inset-top)) 16px auto auto;
  z-index: 1600;
  width: min(310px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid var(--xity-border);
  border-radius: 12px;
  background: var(--xity-card);
  color: var(--xity-ink);
  box-shadow: 0 14px 32px #0f172a30;
}

.xity-theme-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  border: 0;
  margin: 0;
  padding: 0;
}

.xity-theme-choices legend {
  margin: 0 0 10px;
  font-weight: 700;
}

.xity-theme-choices label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid var(--xity-border);
  border-radius: 8px;
  color: var(--xity-ink);
  font-size: 12px;
  cursor: pointer;
}

.xity-theme-choices label:has(input:checked) {
  box-shadow: inset 0 0 0 2px var(--xity-accent);
}

.xity-theme-choices input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.xity-theme-choices label:focus-within,
.xity-appearance :is(summary, button, input):focus-visible {
  outline: 2px solid var(--xity-accent);
  outline-offset: 2px;
}

.xity-swatch {
  width: 22px;
  height: 22px;
  border: 1px solid #94a3b8;
  border-radius: 50%;
  background: #1d4ed8;
}

.xity-swatch-turquesa { background: #0e6571; }
.xity-swatch-verde { background: #146641; }
.xity-swatch-violeta { background: #6544ae; }
.xity-swatch-claro { background: #e5eaf2; }
.xity-swatch-oscuro { background: #161f31; }

.xity-wide-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
  color: var(--xity-ink);
}

.xity-wide-label input { width: auto; height: auto; accent-color: var(--xity-accent); }

.xity-theme-reset {
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--xity-accent);
  text-decoration: underline;
  cursor: pointer;
}

body[data-xity-wide="false"] .main > :not(.topbar) {
  max-width: 1320px !important;
  margin-inline: auto !important;
}

body.selector-body[data-xity-wide="true"] .selector-page { width: min(1480px, calc(100% - 32px)); }

.xity-sales-chart {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.xity-sales-chart li {
  display: grid;
  grid-template-columns: 4.25rem minmax(1rem, 1fr) minmax(6.5rem, auto);
  align-items: center;
  gap: 0.5rem;
  color: var(--xity-secondary, #475569);
  font-size: 13px;
}

.xity-sales-chart strong { text-align: end; color: var(--xity-ink, #16243a); }
.xity-sales-track { height: 7px; background: var(--xity-subtle, #edf2f8); border-radius: 6px; }
.xity-sales-track i { display: block; height: 100%; border-radius: inherit; background: var(--xity-accent, #1d4ed8); }
.xity-sales-track i.is-negative { background: #dc5757; }

.login-v57-only .pub57-login-page-card {
  border: 1px solid #365581;
  border-radius: 18px;
  box-shadow: 0 16px 44px #030d2050;
}

.login-v57-only .pub57-login-form input:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.xity-public-actions,
.xity-login-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xity-login-head {
  justify-content: space-between;
  margin-bottom: 18px;
}

.xity-login-head .pub57-login-brand { margin: 0; }

body.public-v57-body[data-xity-theme] {
  --xity-public-background: color-mix(in srgb, var(--xity-accent) 24%, #061327);
}

body.public-v57-body[data-xity-theme="oscuro"] { --xity-public-background: #111827; }
body.public-v57-body[data-xity-theme="claro"] { --xity-public-background: #25446a; }

body.public-v57-body[data-xity-theme] .pub57-nav {
  background: var(--xity-public-background);
  border-bottom: 1px solid var(--xity-accent);
}

body.public-v57-body[data-xity-theme] :is(.pub57-hero, .pub57-login-panel) {
  box-shadow: inset 0 3px var(--xity-accent);
}

body.login-v57-only[data-xity-theme] {
  background: radial-gradient(ellipse at top, var(--xity-public-background), #061327 78%) !important;
}

@media (max-width: 900px) {
  .xity-theme-panel { inset: max(12px, env(safe-area-inset-top)) 12px auto auto; }
}

@media (max-width: 420px) {
  .pub57-nav:has(.xity-public-actions) { flex-wrap: wrap; }
}
