:root {
  --bg: #F1F2FA;
  --surface: #ffffff;
  --surface-muted: #F7F8FC;
  --line: #E1E4F0;
  --text: #162447;
  --muted: #5B657E;
  --accent: #5864FF;
  --accent-tint: #ECEEFF;
  --accent-2: #FF8A5C;
  --danger: #a73535;
  --status-success-bg: #E7F3EC;
  --status-success-text: #1F6B45;
  --status-success-border: #cbded5;
  --status-danger-bg: #FBEBEB;
  --status-danger-text: #A73535;
  --status-danger-border: #EBC6C6;
  --shadow: 0 20px 44px rgba(22, 36, 71, 0.12);
  --display-font: Arimo, Bahnschrift, "Segoe UI Semibold", Inter, "Segoe UI", Arial, sans-serif;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --sidebar-w: 76px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 38px;
  padding: 0 14px;
}

button.secondary {
  background: #E7E9F5;
  color: var(--text);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  border: 1px solid #c7c7cd;
  border-radius: 6px;
  /* Gris neutro (sin tinte azul, a diferencia de --line/--surface-muted) a proposito -- para
     que un campo editable se distinga de un vistazo de su etiqueta y del fondo blanco del
     panel, sin depender solo del borde (que es sutil). */
  background: #e8e8ec;
  color: var(--text);
  min-height: 36px;
  padding: 7px 9px;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

label {
  display: grid;
  gap: 5px;
  /* Negro (no --muted/--text, ambos con tinte azul) a proposito -- la etiqueta debe leerse
     como texto neutro, dejando el color/contraste para el campo editable en si. */
  color: #14161a;
  font-size: 12px;
  font-weight: 700;
}

#app {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.app-sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 0;
  background: linear-gradient(180deg, #5864FF 0%, #4750DE 100%);
  color: #fff;
}

.sidebar-brand {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-family: var(--display-font);
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 22px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.sidebar-link {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-decoration: none;
}

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

.sidebar-link.active {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(15, 23, 60, 0.28);
}

.sidebar-link[hidden] {
  display: none;
}

.sidebar-icon {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
}

.icon-nav-tableros {
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 8px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 12px 0 / 8px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 0 12px / 8px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 12px 12px / 8px 8px no-repeat;
}

.icon-nav-sync::before {
  content: "\27F3";
  display: block;
  font-size: 20px;
  line-height: 20px;
  text-align: center;
}

.icon-nav-config::before {
  content: "\2699";
  display: block;
  font-size: 20px;
  line-height: 20px;
  text-align: center;
}

.icon-nav-users::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.icon-nav-users::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 10px;
  border-radius: 10px 10px 0 0;
  background: currentColor;
}

.sidebar-user {
  position: relative;
  margin-top: auto;
}

.sidebar-user summary {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  list-style: none;
}

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

.sidebar-user summary:hover {
  background: rgba(255, 255, 255, 0.28);
}

.sidebar-user-popover {
  position: absolute;
  left: calc(100% + 10px);
  bottom: 0;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: 220px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
}

.sidebar-user-info {
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.sidebar-user-info strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-info span {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-popover button {
  width: 100%;
}

.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  min-height: 46px;
  padding: 0 24px;
  text-decoration: none;
  width: 100%;
}

.pill-button:hover {
  filter: brightness(1.08);
}

.app-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  flex: 1;
  min-height: 0;
}

.app-body.panel-collapsed {
  grid-template-columns: minmax(0, 1fr) 0;
}

.inspector {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-left: 1px solid var(--line);
  background: var(--surface-muted);
  padding: 16px;
  overflow-y: auto;
}

.app-body.panel-collapsed .inspector {
  padding: 0;
  border-left: 0;
  overflow: hidden;
}

.workspace {
  min-width: 0;
  min-height: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand span:not(.mark) {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-weight: 800;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.visual {
  border-radius: 8px;
  background: var(--surface);
}

/* Borde visible + sombra apoyada en la parte de abajo (tipo tarjeta flotando) -- por widget, con
   el check "Sombra y borde" en Personalizar > Visual (visual.cardEffect; ausente/true = activo,
   ver renderVisual()). A proposito el estado "sin efecto" no deja NADA (ni borde ni sombra) --
   antes se probo con un --shadow generico de fondo siempre presente y la diferencia entre
   encendido/apagado casi no se notaba; asi el check si cambia algo visible. */
.visual.card-effects {
  /* --line (#E1E4F0) es casi del mismo tono que el fondo del lienzo (--bg #F1F2FA) -- un borde
     de ese color practicamente no se ve. Se usa un gris mas oscuro/saturado a proposito, solo
     aca (no se toca --line global para no afectar el resto de la UI). */
  border: 1px solid #B7BDD4;
  box-shadow: 0 2px 4px rgba(22, 36, 71, 0.16), 0 14px 32px rgba(22, 36, 71, 0.24);
}

.panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.panel h2 {
  margin: 0;
  font-size: 14px;
}

.panel p,
#subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  border-radius: 999px;
  background: var(--status-success-bg);
  color: var(--status-success-text);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}

.badge.muted {
  background: var(--surface-muted);
  color: var(--muted);
}

.badge.bad {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

.refresh-today-status {
  flex-basis: 100%;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.refresh-today-status.pending {
  background: var(--surface-muted);
  color: var(--muted);
}

.refresh-today-status.ok {
  background: var(--status-success-bg);
  color: var(--status-success-text);
}

.refresh-today-status.error {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

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

.wide {
  grid-column: 1 / -1;
}

.row,
.toolbar {
  display: flex;
  gap: 8px;
}

.row button,
.toolbar button {
  flex: 1;
}

.search {
  background: var(--surface-muted);
}

.field-list,
.saved-list {
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.field-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.field-item {
  cursor: pointer;
}

.field-item:hover {
  border-color: rgba(88, 100, 255, 0.35);
  background: var(--surface-muted);
}

.field-item.active-field {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.field-item strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

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

.title-input {
  border: 0;
  background: transparent;
  font-size: 22px;
  font-weight: 850;
  min-height: 30px;
  padding: 0;
  font-family: var(--display-font);
  letter-spacing: -0.01em;
}

.sync-page-header {
  padding: 22px 24px 6px;
}

.sync-page-header h1 {
  margin: 0;
  font-family: var(--display-font);
  font-size: 22px;
  font-weight: 850;
  color: var(--text);
  letter-spacing: -0.01em;
}

.ribbon {
  position: relative;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.ribbon-collapse-toggle {
  position: absolute;
  left: 50%;
  bottom: -13px;
  transform: translateX(-50%);
  z-index: 5;
  width: 40px;
  min-width: 40px;
  height: 14px;
  min-height: 14px;
  padding: 0;
  border-radius: 0 0 9px 9px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(22, 36, 71, 0.2);
}

.ribbon-collapse-toggle:hover {
  background: #454fe0;
}

.ribbon-collapse-icon {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.ribbon.ribbon-collapsed .ribbon-body {
  display: none;
}

.ribbon.ribbon-collapsed .ribbon-collapse-icon {
  transform: rotate(180deg);
}

.ribbon-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 28px;
  padding: 10px 18px 0;
}

.ribbon-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ribbon-title-block {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.ribbon-tabs {
  display: flex;
  gap: 2px;
  align-self: stretch;
  align-items: flex-end;
}

.ribbon-tab {
  background: transparent;
  border: 0;
  border-radius: 6px 6px 0 0;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  min-height: 34px;
  padding: 8px 16px;
}

.ribbon-tab:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.ribbon-tab.active {
  background: #ffffff;
  color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.ribbon-body {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 6px 18px 8px;
  overflow-x: auto;
}

.ribbon-panel {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.ribbon-panel[hidden] {
  display: none;
}

.ribbon-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 2px;
}

.ribbon-group-buttons {
  display: flex;
  align-items: flex-start;
  gap: 2px;
}

.ribbon-caption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.ribbon-divider {
  align-self: stretch;
  width: 1px;
  margin: 4px 6px;
  background: var(--line);
}

.ribbon-btn,
.ribbon-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 60px;
  min-height: 62px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 6px 8px;
  text-align: center;
}

.ribbon-btn:hover {
  background: var(--surface-muted);
}

.ribbon-btn:disabled {
  opacity: 0.4;
}

.ribbon-select {
  color: var(--muted);
  font-weight: 800;
  gap: 3px;
}

.ribbon-select select,
.ribbon-select input:not([type="color"]):not([type="range"]):not([type="file"]),
.ribbon-select textarea {
  min-height: 34px;
  max-width: 150px;
  padding: 4px 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.ribbon-select input[type="color"] {
  width: 40px;
  min-height: 30px;
  padding: 2px;
}

.ribbon-select input[type="range"] {
  width: 90px;
  align-self: center;
}

.ribbon-select input[type="file"] {
  max-width: 140px;
  min-height: 30px;
  padding: 4px 6px;
  font-size: 10px;
}

.ribbon-select textarea {
  min-height: 46px;
  max-height: 70px;
  resize: vertical;
}

.ribbon-select-wide {
  min-width: 190px;
}

.ribbon-select-wide select,
.ribbon-select-wide input:not([type="color"]):not([type="range"]):not([type="file"]),
.ribbon-select-wide textarea {
  max-width: 220px;
  width: 220px;
}

.ribbon-panel-personalizar {
  position: relative;
}

.ribbon-panel-personalizar .ribbon-dropdown > .ribbon-btn {
  min-width: 68px;
}

.ribbon-panel-personalizar .ribbon-dropdown-body {
  width: 270px;
}

.ribbon-panel-personalizar .ribbon-dropdown-body label {
  display: grid;
  gap: 5px;
  color: #14161a;
  font-size: 14px;
  font-weight: 700;
}

.ribbon-panel-personalizar .ribbon-dropdown-body select,
.ribbon-panel-personalizar .ribbon-dropdown-body input:not([type="color"]),
.ribbon-panel-personalizar .ribbon-dropdown-body textarea {
  width: 100%;
  min-height: 38px;
  font-size: 14px;
}

.ribbon-panel-personalizar .ribbon-select-color {
  min-height: 40px;
  justify-content: center;
}

.ribbon-icon.icon-view::before { content: "\25A6"; }
.ribbon-icon.icon-width::before { content: "\2194"; }
.ribbon-icon.icon-height::before { content: "\2195"; }
.ribbon-icon.icon-density::before { content: "\2630"; }
.ribbon-icon.icon-letter-t::before { content: "T"; font-weight: 800; font-size: 13px; }
.ribbon-icon.icon-align::before { content: "\21E4"; }
.ribbon-icon.icon-sort::before { content: "\21C5"; }
.ribbon-icon.icon-direction::before { content: "\25BC"; font-size: 11px; }
.ribbon-icon.icon-sum::before { content: "\03A3"; font-weight: 800; font-size: 15px; }
.ribbon-icon.icon-hash::before { content: "#"; font-weight: 800; font-size: 14px; }
.ribbon-icon.icon-max::before { content: "\2265"; font-weight: 800; font-size: 14px; }
.ribbon-icon.icon-fontsize::before { content: "Aa"; font-size: 11px; font-weight: 800; }
.ribbon-icon.icon-fontfamily::before { content: "Aa"; font-size: 11px; font-family: Georgia, serif; font-style: italic; }
.ribbon-icon.icon-paragraph::before { content: "\00B6"; }
.ribbon-icon.icon-align-left::before { content: "\25C0"; }
.ribbon-icon.icon-align-right::before { content: "\25B6"; }
.ribbon-icon.icon-align-h::before { content: "\2194"; }
.ribbon-icon.icon-align-top::before { content: "\25B2"; }
.ribbon-icon.icon-align-bottom::before { content: "\25BC"; }
.ribbon-icon.icon-align-v::before { content: "\2195"; }
.ribbon-icon.icon-distribute-h::before { content: "\21D4"; }
.ribbon-icon.icon-distribute-v::before { content: "\21D5"; }

.ribbon-panel-personalizar .empty {
  flex: 1;
  min-height: 60px;
  margin: 4px 0;
}

.ribbon-panel-personalizar #inspectorForm,
.ribbon-panel-personalizar #inspectorBulkForm {
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 0;
}

.ribbon-tab-badge {
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  margin-left: 6px;
  padding: 2px 8px;
  vertical-align: middle;
}

.ribbon-dropdown {
  position: relative;
}

.ribbon-dropdown > summary {
  list-style: none;
  cursor: pointer;
}

.ribbon-dropdown > summary::-webkit-details-marker {
  display: none;
}

.ribbon-dropdown > summary span:last-child::after {
  content: "\25BE";
  color: var(--muted);
  display: inline-block;
  font-size: 9px;
  margin-left: 4px;
}

.ribbon-dropdown[open] > summary {
  background: var(--accent-tint);
  border-radius: 6px;
  color: var(--accent);
}

.ribbon-dropdown-body {
  display: none;
}

.ribbon-dropdown[open] > .ribbon-dropdown-body {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: grid;
  gap: 10px;
  width: 320px;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px;
  text-align: left;
}

.ribbon-icon.icon-duplicate::before {
  content: "\29C9";
  font-size: 15px;
}

.ribbon-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 24px;
  font-size: 19px;
  font-weight: 800;
  color: var(--muted);
}

.ribbon-btn:hover .ribbon-icon {
  color: var(--accent);
}

.ribbon-icon.icon-new::before {
  content: "+";
  font-size: 20px;
}

.ribbon-icon.icon-save::before {
  content: "\2193";
  font-size: 17px;
}

.ribbon-icon.icon-upload::before {
  content: "\2191";
  font-size: 17px;
}

.ribbon-icon.icon-calc::before {
  content: "fx";
  font-size: 13px;
  font-weight: 800;
  font-style: italic;
}

.ribbon-icon.icon-delete::before {
  content: "\D7";
  font-size: 18px;
}

.user-traspaso {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.user-traspaso select {
  width: auto;
  min-height: 28px;
  padding: 2px 6px;
  font-size: 11px;
}

.user-traspaso button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

.ribbon-icon.icon-owner::before {
  content: "\21C4";
  font-size: 17px;
}

.ribbon-icon.icon-share::before {
  content: "\2197";
  font-size: 17px;
}

.ribbon-icon.icon-budget::before {
  content: "%";
  font-size: 15px;
}

.ribbon-icon.icon-connection {
  font-size: 10px;
  letter-spacing: 0.02em;
}

.ribbon-icon.icon-refresh-date::before {
  content: "\27F3";
  font-size: 16px;
}

.ribbon-icon.icon-undo::before {
  content: "\21B6";
  font-size: 17px;
}

.ribbon-icon.icon-redo::before {
  content: "\21B7";
  font-size: 17px;
}

.ribbon-icon.icon-panel {
  position: relative;
  width: 18px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.ribbon-icon.icon-panel::after {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  right: 3px;
  border-left: 2px solid currentColor;
}

.builder {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.sheetbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.sheet-tabs {
  display: flex;
  flex: 1;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
}

.sheet-tab {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
}

.sheet-tab.active {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

.data-freshness {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.data-freshness::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-success-text);
}

.licencia-chip {
  border-radius: 999px;
  padding: 4px 10px;
  background: #FFF3EC;
  color: #B4532A;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.licencia-chip:hover {
  text-decoration: underline;
}

.users-licencia {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
}

.users-licencia.is-full {
  background: #FFF3EC;
  color: #B4532A;
  font-weight: 700;
}

.data-freshness.syncing {
  color: var(--accent);
  font-weight: 700;
}

.data-freshness.syncing::before {
  background: var(--accent);
  animation: data-freshness-pulse 1.2s ease-in-out infinite;
}

@keyframes data-freshness-pulse {
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .data-freshness.syncing::before { animation: none; }
}

.cross-filter-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.cross-filter-clear {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 800;
  font-size: 11px;
  border-radius: 999px;
  padding: 3px 8px;
  cursor: pointer;
}

.cross-filter-clear:hover {
  background: rgba(88, 100, 255, 0.16);
}

.sheet-name-input {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  min-height: 24px;
  min-width: 96px;
  max-width: 180px;
  outline: 0;
  padding: 0;
}

.viewport-toggle {
  display: flex;
  gap: 6px;
}

.viewport-toggle .tool-icon.active {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.screen-icon {
  display: block;
  position: relative;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.desktop-icon {
  width: 22px;
  height: 15px;
}

.desktop-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 14px;
  width: 7px;
  height: 5px;
  border-bottom: 2px solid currentColor;
}

.mobile-icon {
  width: 13px;
  height: 22px;
  border-radius: 5px;
}

.visual-palette {
  display: grid;
  grid-template-columns: repeat(4, 40px);
  gap: 7px;
}

.inspector-palette {
  grid-template-columns: repeat(4, 1fr);
}

.inspector-palette .tool-icon {
  width: 100%;
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0;
}

.tool-icon:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.viz-icon {
  display: block;
  position: relative;
  width: 22px;
  height: 22px;
}

.icon-card {
  border: 2px solid currentColor;
  border-radius: 4px;
}

.icon-card::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 9px;
  border-top: 3px solid currentColor;
}

.icon-bar {
  background:
    linear-gradient(currentColor, currentColor) 1px 4px / 18px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 1px 10px / 13px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 1px 16px / 20px 4px no-repeat;
}

.icon-column {
  background:
    linear-gradient(currentColor, currentColor) 1px 12px / 5px 10px no-repeat,
    linear-gradient(currentColor, currentColor) 9px 4px / 5px 18px no-repeat,
    linear-gradient(currentColor, currentColor) 17px 8px / 5px 14px no-repeat;
}

.icon-bar::before,
.icon-bar::after,
.icon-column::before,
.icon-column::after {
  content: "";
  display: none;
}

/* Variantes apiladas: mismas 3 barras/columnas, pero cada una partida en dos segmentos (con un
   hueco angosto entre ellos) para sugerir "varias medidas concatenadas en una sola barra" en vez
   de barras paralelas independientes. Las 100% llevan ademas un marco -- todas del mismo largo,
   como corresponde a un total siempre normalizado a 100%. */
.icon-bar-stacked {
  background:
    linear-gradient(currentColor, currentColor) 1px 4px / 10px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 12px 4px / 7px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 1px 10px / 7px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 9px 10px / 11px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 1px 16px / 13px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 15px 16px / 5px 4px no-repeat;
}

.icon-column-stacked {
  background:
    linear-gradient(currentColor, currentColor) 1px 14px / 5px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 1px 6px / 5px 6px no-repeat,
    linear-gradient(currentColor, currentColor) 9px 10px / 5px 12px no-repeat,
    linear-gradient(currentColor, currentColor) 9px 3px / 5px 5px no-repeat,
    linear-gradient(currentColor, currentColor) 17px 8px / 5px 14px no-repeat,
    linear-gradient(currentColor, currentColor) 17px 2px / 5px 4px no-repeat;
}

.icon-bar-stacked100,
.icon-column-stacked100 {
  border: 2px solid currentColor;
  border-radius: 3px;
}

.icon-bar-stacked100 {
  background:
    linear-gradient(currentColor, currentColor) 3px 5px / 10px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 13px 5px / 6px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 10px / 7px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 10px 10px / 9px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 15px / 13px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 16px 15px / 3px 3px no-repeat;
}

.icon-column-stacked100 {
  background:
    linear-gradient(currentColor, currentColor) 3px 12px / 4px 6px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 5px / 4px 6px no-repeat,
    linear-gradient(currentColor, currentColor) 10px 9px / 4px 9px no-repeat,
    linear-gradient(currentColor, currentColor) 10px 3px / 4px 5px no-repeat,
    linear-gradient(currentColor, currentColor) 15px 7px / 4px 11px no-repeat,
    linear-gradient(currentColor, currentColor) 15px 3px / 4px 3px no-repeat;
}

.icon-pie,
.icon-donut {
  border-radius: 50%;
  background: conic-gradient(currentColor 0 38%, transparent 38% 100%);
  border: 2px solid currentColor;
}

.icon-donut::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #fff;
}

.icon-table {
  border: 2px solid currentColor;
  background:
    linear-gradient(currentColor, currentColor) 0 7px / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 14px / 100% 2px no-repeat,
    linear-gradient(90deg, currentColor, currentColor) 7px 0 / 2px 100% no-repeat,
    linear-gradient(90deg, currentColor, currentColor) 14px 0 / 2px 100% no-repeat;
}

.icon-matriz {
  border: 2px solid currentColor;
  background:
    linear-gradient(currentColor, currentColor) 0 7px / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 14px / 100% 2px no-repeat,
    linear-gradient(90deg, currentColor, currentColor) 6px 0 / 2px 100% no-repeat,
    linear-gradient(90deg, currentColor, currentColor) 4px 9px / 6px 2px no-repeat,
    linear-gradient(90deg, currentColor, currentColor) 6px 16px / 8px 2px no-repeat;
}

.icon-slicer {
  border: 2px solid currentColor;
  border-top: 0;
  transform: perspective(20px) rotateX(-12deg);
}

.icon-slicer::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 16px;
  width: 8px;
  height: 6px;
  background: currentColor;
  clip-path: polygon(20% 0, 80% 0, 60% 100%, 40% 100%);
}

.icon-text {
  width: 20px;
  height: 18px;
}

.icon-text::before {
  content: "T";
  position: absolute;
  inset: -2px 0 0;
  display: grid;
  place-items: center;
  color: currentColor;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.icon-image {
  border: 2px solid currentColor;
  border-radius: 3px;
  background:
    radial-gradient(circle at 70% 28%, currentColor 0 2px, transparent 2px),
    linear-gradient(135deg, transparent 0 45%, currentColor 45% 55%, transparent 55%),
    linear-gradient(45deg, transparent 0 54%, currentColor 54% 64%, transparent 64%);
}

.canvas {
  position: relative;
  min-height: 0;
  border: 1px dashed #cfd5c8;
  border-radius: 8px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    #fdfefb;
  background-size: 24px 24px;
  overflow: auto;
}

.canvas.mobile-layout {
  width: min(390px, 100%);
  min-height: 760px;
  margin-inline: auto;
}

.canvas.desktop-layout {
  width: 100%;
}

.snap-guide {
  position: absolute;
  background: var(--accent-2);
  pointer-events: none;
  z-index: 60;
  display: none;
}

.snap-guide.visible {
  display: block;
}

.snap-guide-v {
  width: 1px;
  top: 0;
  bottom: 0;
}

.snap-guide-h {
  height: 1px;
  left: 0;
  right: 0;
}

.visual {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  resize: none;
  user-select: none;
}

.visual.selected {
  outline: 3px solid rgba(88, 100, 255, 0.32);
}

.visual-card {
  border-top: 3px solid var(--accent-2);
}

.visual-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  cursor: move;
  padding: 10px 12px;
  /* Con varias lineas de subtitulo el encabezado podia comerse casi toda la altura del
     widget y dejar el cuerpo de datos practicamente invisible. Se limita a un porcentaje del
     widget y se vuelve desplazable si hace falta, para que el cuerpo siempre se vea. */
  max-height: 45%;
  flex-shrink: 0;
  overflow-y: auto;
}

.visual-header h3 {
  width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.visual-subtitle {
  width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.35;
}

.visual-header-divider {
  border-bottom: 2px solid var(--text);
}

.visual-body {
  flex: 1;
  min-height: 0;
  padding: 12px;
  overflow: auto;
  user-select: text;
}

.visual-compact .visual-header {
  padding: 7px 10px;
}

.visual-compact .visual-header h3 {
  font-size: 12px;
}

.visual-compact .visual-body {
  padding: 8px 10px;
}

.visual-compact.visual-card .card-value {
  line-height: 0.98;
}

.visual-compact.visual-slicer .slicer-dropdown,
.visual-compact.visual-slicer .range-slicer {
  gap: 6px;
}

.visual-compact.visual-slicer .slicer-list label,
.visual-compact.visual-slicer .slicer-tiles label {
  padding: 5px 6px;
}

.visual-text .visual-body,
.visual-image .visual-body {
  display: grid;
  place-items: stretch;
  overflow: hidden;
  cursor: move;
}

.visual-text .visual-header,
.visual-image .visual-header {
  display: none;
}

.text-visual-content {
  display: flex;
  align-items: center;
  min-height: 100%;
  font-weight: 850;
  line-height: 1.05;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.image-visual-content {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
}

.image-placeholder {
  display: grid;
  place-items: center;
  min-height: 100%;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  padding: 10px;
  text-align: center;
}

.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 0 50%, rgba(88, 100, 255, 0.28) 50% 60%, transparent 60% 100%),
    linear-gradient(135deg, transparent 0 68%, rgba(88, 100, 255, 0.45) 68% 76%, transparent 76% 100%);
}

.card-value {
  display: flex;
  align-items: center;
  min-height: 100%;
  font-weight: 850;
  line-height: 1.05;
  font-family: var(--display-font);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.card-metric-list {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 100%;
}

.card-metric {
  display: grid;
  gap: 2px;
}

.card-metric strong {
  overflow-wrap: anywhere;
  font-size: 0.95em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.card-metric.primary strong {
  font-size: 1.25em;
  font-family: var(--display-font);
  letter-spacing: -0.01em;
}

.card-metric-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 850;
}

.field-config {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
}

.compact-title h2 {
  font-size: 12px;
}

#inspectorForm {
  display: grid;
  gap: 8px;
}

.inspector-group {
  border: 1px solid #e4e8df;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.inspector-group summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  min-height: 42px;
  padding: 9px 10px;
}

.inspector-group summary::-webkit-details-marker {
  display: none;
}

.inspector-group summary::after {
  content: ">";
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  transform: rotate(0deg);
}

.inspector-group[open] summary::after {
  transform: rotate(90deg);
}

.inspector-group summary span {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.inspector-group summary small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  grid-column: 1;
}

.inspector-group-body {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
  padding: 10px;
}

.series-colors {
  display: grid;
  gap: 7px;
  border: 1px solid #e4e8df;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.series-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.series-color-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 11px;
}

.series-color-row input {
  height: 28px;
  min-height: 28px;
  padding: 2px;
}

.series-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-empty {
  color: var(--muted);
  font-size: 11px;
}

.metric-config {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.metric-list {
  display: grid;
  gap: 6px;
}

.mini-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  align-items: end;
  gap: 8px;
}

.calc-term-row {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-bottom: 6px;
}

.calc-term-row label {
  flex: 1;
  min-width: 0;
}

.calc-term-row button {
  flex: 0 0 auto;
}

.table-fields-list {
  display: grid;
  gap: 6px;
}

.upload-column-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 7px 10px;
}

.upload-column-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text);
}

.upload-column-row select {
  min-height: 32px;
  font-size: 12px;
}

.upload-validate-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
  margin-bottom: 8px;
}

.upload-validate-group h3 {
  font-size: 12px;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-validate-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.upload-validate-value {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.upload-validate-value strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.upload-validate-value em {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.upload-correction-accepted {
  border-color: var(--accent);
}

.upload-warning-list {
  display: grid;
  gap: 4px;
  margin: 0 0 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  font-size: 11px;
  font-weight: 700;
  list-style: none;
}

.table-field-row,
.metric-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.table-field-row.dragging,
.metric-row.dragging {
  opacity: 0.55;
}

.table-field-row.drop-target,
.metric-row.drop-target {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.table-field-row summary,
.metric-row summary {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  min-height: 34px;
  padding: 7px 8px;
}

.table-field-row summary::-webkit-details-marker,
.metric-row summary::-webkit-details-marker {
  display: none;
}

.drag-handle::before {
  content: "::";
  color: var(--muted);
  display: inline-block;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
}

.table-field-row strong,
.metric-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
}

.table-field-row em,
.metric-row em {
  border-radius: 999px;
  background: #eef2e9;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  padding: 3px 6px;
  white-space: nowrap;
}

.table-field-settings,
.metric-settings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 8px;
}

.table-field-row button,
.metric-row button {
  min-height: 32px;
  padding: 0 10px;
}

.matrix-level-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
}

.matrix-level-row strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-level-label-picker select {
  max-width: 128px;
  font-size: 11px;
  padding: 3px 4px;
}

.matrix-measure-label-input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 3px 6px;
}

.subtitle-lines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.subtitle-lines-header span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.subtitle-lines-list {
  display: grid;
  gap: 6px;
}

.subtitle-line-row select[data-subtitle-line-type],
.subtitle-line-row select[data-subtitle-line-align] {
  flex: 0 0 auto;
  max-width: 96px;
  font-size: 11px;
  padding: 3px 4px;
}

.subtitle-line-row select[data-subtitle-line-campo] {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 3px 6px;
}

.bar-list {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(90px, 2fr) auto;
  gap: 8px;
  align-items: center;
  font-size: var(--data-label-size, 12px);
}

.multi-bar-row {
  grid-template-columns: minmax(90px, 0.8fr) minmax(110px, 1.5fr) minmax(90px, auto);
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-series,
.bar-values {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.bar-values strong {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 12px;
  border-radius: 99px;
  background: #e8ece4;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--accent);
}

/* Modo "apilado"/"100% apilado": un solo .bar-track por fila, con los .bar-fill de cada
   metrica uno junto al otro (en vez de un .bar-track por metrica, apilados en filas
   paralelas, que es el modo "agrupado" de siempre). */
.bar-track-stacked {
  display: flex;
}

.bar-track-stacked .bar-fill {
  min-width: 0;
}

.column-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(34px, 1fr);
  align-items: end;
  gap: 10px;
  min-height: 100%;
}

.column-item {
  display: grid;
  grid-template-rows: minmax(120px, 1fr) auto auto;
  gap: 6px;
  min-width: 0;
}

.column-track {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
  min-height: 120px;
  border-radius: 6px;
  background: var(--line);
  overflow: hidden;
}

.column-fill {
  width: 70%;
  min-height: 2px;
  border-radius: 5px 5px 0 0;
}

.multi-column-track .column-fill {
  width: min(26%, 18px);
}

/* Modo "apilado"/"100% apilado" para columnas (vertical): los segmentos se apilan de abajo
   hacia arriba (column-reverse: la primera metrica en el orden del Eje Y queda como base). Se
   fuerza flex:0 0 auto para que el "height" explicito de cada segmento se respete tal cual, sin
   que flex-grow/flex-shrink lo redistribuya. */
.column-track-stacked {
  flex-direction: column-reverse;
}

.column-track-stacked .column-fill {
  width: 100%;
  flex: 0 0 auto;
  border-radius: 0;
}

.column-track-stacked .column-fill:last-child {
  border-radius: 5px 5px 0 0;
}

.column-label,
.column-value {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-label {
  color: var(--muted);
  font-size: var(--data-label-size, 11px);
}

.column-value {
  font-size: var(--data-label-size, 11px);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

/* Envoltorio nuevo con titulos de eje tipo Excel/Power BI: titulo del Eje Y rotado a la
   izquierda (nombre de la medida), grafico en el medio, titulo del Eje X debajo (campo de
   categoria). Reemplaza el antiguo ".column-axis-caption" (una sola linea arriba). */
.column-chart-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: stretch;
  min-height: 100%;
}

.column-chart-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.column-chart-body .column-chart {
  flex: 1;
  /* .column-chart trae "min-height:100%" (para cuando NO tiene este wrapper alrededor) y
     .column-item pide un minimo de 120px para la barra -- dentro de este flex column eso hacia
     que las barras reclamaran TODO el alto disponible, dejando al titulo del Eje X sin espacio
     (quedaba recortado fuera de la vista en tarjetas no muy altas). min-height:0 deja que este
     item se achique si hace falta, para que el titulo de abajo siempre tenga su propia linea. */
  min-height: 0;
}

.column-y-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  align-self: center;
  text-align: center;
  color: var(--muted);
  font-size: var(--data-label-size, 10px);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 100%;
}

.column-x-title {
  text-align: center;
  color: var(--muted);
  font-size: var(--data-label-size, 10px);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.circular-chart {
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(120px, 1.1fr);
  gap: 14px;
  align-items: center;
  min-height: 100%;
}

/* Con etiquetas "alrededor de la dona" hace falta aire extra arriba/abajo del circulo, para
   que una etiqueta que cae cerca de las 12 (o las 6) no quede pegada al titulo de la tarjeta
   o al borde inferior. */
.circular-chart.ring-mode {
  padding: 18px 4px;
}

.circular-multi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  min-height: 100%;
}

.circular-small {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}

.circular-small > strong {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.circular-small .pie-shape,
.circular-small .donut-shape {
  width: min(100%, 130px);
}

.compact-legend {
  gap: 5px;
}

.compact-legend .legend-row {
  font-size: 10px;
}

.circular-shape-wrap {
  position: relative;
  justify-self: center;
  width: min(100%, var(--circle-size, 210px));
}

.pie-shape,
.donut-shape {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 50%;
}

.circular-shape-wrap .pie-shape,
.circular-shape-wrap .donut-shape {
  justify-self: unset;
}

/* Etiqueta de valor/porcentaje "alrededor de la dona" (Personalizar > Formato > posicion) --
   left/top vienen ya calculados en porcentaje (no en pixeles) para funcionar igual sin
   importar el tamano real renderizado del circulo. Texto plano (sin pastilla): con radiusPct
   > 1 (ver renderPieRingLabels) la etiqueta ya cae afuera del anillo de color, asi que no
   necesita fondo/borde propio para distinguirse del relleno -- eso era lo que se veia mal
   cuando quedaba encima de la dona.
*/
.pie-ring-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: var(--data-label-size, 10px);
  font-weight: 800;
  white-space: nowrap;
  color: var(--text);
  cursor: grab;
  user-select: none;
  padding: 1px 3px;
  border-radius: 4px;
}

.pie-ring-label:hover {
  background: var(--accent-tint, rgba(88, 100, 255, 0.12));
}

.pie-ring-label.dragging {
  cursor: grabbing;
  background: var(--accent-tint, rgba(88, 100, 255, 0.18));
  z-index: 3;
}

/* Lineas guia entre cada etiqueta "alrededor de la dona" y su porcion (Personalizar > Formato
   > posicion). Mismo viewBox 0-100 que las coordenadas left/top en % de las etiquetas, asi el
   calculo en JS se reusa tal cual sin convertir unidades. pointer-events:none para que el mouse
   pase de largo hacia la etiqueta que si es arrastrable. */
.pie-leader-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.pie-leader-line {
  stroke-width: 0.6;
  opacity: 0.55;
}

.pie-leader-line.dragging {
  stroke-width: 1;
  opacity: 0.9;
}

.pie-measure-caption {
  text-align: center;
  font-size: var(--data-label-size, 11px);
  font-weight: 700;
  color: var(--muted);
}

.donut-shape {
  position: relative;
}

.donut-shape::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.chart-legend {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  font-size: var(--data-label-size, 12px);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-value {
  font-weight: 850;
  white-space: nowrap;
}

.bar-sticky-header {
  position: sticky;
  top: -12px;
  margin: -12px -12px 0;
  padding: 12px 12px 0;
  background: var(--surface);
  z-index: 2;
}

.metric-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  margin-bottom: 8px;
}

.metric-legend .legend-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.bar-axis {
  padding-bottom: 4px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

.bar-axis-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bar-track {
  background-image:
    linear-gradient(var(--line) 0 0),
    linear-gradient(var(--line) 0 0),
    linear-gradient(var(--line) 0 0);
  background-size: 1px 100%;
  background-repeat: no-repeat;
  background-position: 25% 0, 50% 0, 75% 0;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  max-width: 260px;
  padding: 7px;
  text-align: left;
  overflow-wrap: anywhere;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  color: var(--muted);
}

.data-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 850;
  border-top: 2px solid var(--line);
  border-bottom: 0;
}

.data-table .total-row-top td {
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 850;
  border-bottom: 2px solid var(--line);
}

.matrix-table th,
.matrix-table td {
  font-variant-numeric: tabular-nums;
  padding: 4px 7px;
  font-size: 11px;
}

.matrix-sort-header {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.matrix-sort-header:hover {
  color: var(--accent);
}

.matrix-sort-arrow {
  display: inline-block;
  margin-left: 3px;
  font-size: 9px;
  opacity: 0.55;
}

.matrix-sort-header.matrix-sort-active .matrix-sort-arrow {
  opacity: 1;
  color: var(--accent);
}

.matrix-toggle,
.matrix-toggle-spacer {
  display: inline-block;
  width: 16px;
  text-align: center;
}

.matrix-toggle {
  border: 0;
  background: none;
  padding: 0;
  margin-right: 2px;
  font-size: 10px;
  line-height: 1;
  color: inherit;
  cursor: pointer;
  vertical-align: middle;
}

.matrix-toggle:hover {
  color: var(--accent);
}

.matrix-row-leaf td {
  color: var(--muted);
}

.matrix-row-subtotal td {
  font-weight: 800;
  background: var(--surface-muted);
}

/* Click-to-cross-filter: cualquier marca clickeable (barra, fila de leyenda, fila hoja de
   matriz, celda de tabla) trae data-cross-pairs -- cursor de mano en todas, resaltado en la
   que disparo el filtro activo, atenuado en las demas del MISMO widget. */
[data-cross-pairs] {
  cursor: pointer;
}

.cross-filter-active {
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 4px;
  font-weight: 800;
}

.cross-filter-dimmed {
  opacity: 0.4;
}

tr.cross-filter-active td {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 800;
}

tr.cross-filter-dimmed td {
  opacity: 0.4;
}

.matrix-row-subtotal.matrix-depth-1 td {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 850;
}

.matrix-row-subtotal.matrix-depth-2 td {
  background: var(--surface-muted);
}

.matrix-row-grand-total td {
  position: sticky;
  bottom: 0;
  background: var(--text);
  color: #fff;
  font-weight: 900;
  border-top: 2px solid var(--line);
}

.slicer-list {
  display: grid;
  gap: 6px;
}

.slicer-list label,
.slicer-tiles label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 7px;
}

.slicer-list input,
.slicer-tiles input {
  width: auto;
  min-height: auto;
}

.slicer-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 7px;
}

.slicer-tiles label {
  grid-template-columns: auto minmax(0, 1fr);
}

.slicer-tiles small {
  display: none;
}

.slicer-dropdown,
.range-slicer {
  display: grid;
  gap: 10px;
}

.range-slicer .range-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.relative-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px;
}

.empty,
.loading,
.error {
  display: grid;
  place-items: center;
  min-height: 110px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

.error {
  border-color: var(--status-danger-border);
  color: var(--status-danger-text);
}

.hidden {
  display: none !important;
}

.saved-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.saved-button {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 3px;
  padding: 8px;
  text-align: left;
}

.saved-button strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.saved-rename-button {
  flex-shrink: 0;
  width: 30px;
  min-height: auto;
  padding: 0;
  font-size: 13px;
}

.saved-name-input {
  width: 100%;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 5px;
}

.modal {
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(24, 31, 28, 0.28);
}

.modal::backdrop {
  background: rgba(24, 31, 28, 0.35);
}

.modal-card {
  display: grid;
  gap: 12px;
  min-width: min(420px, calc(100vw - 32px));
  padding: 16px;
}

.budget-card {
  min-width: min(560px, calc(100vw - 32px));
}

.budget-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

.budget-options legend {
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  padding: 0 5px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 7px 8px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 120% at 15% 10%, #ECEEFF 0%, var(--bg) 55%);
  z-index: 50;
  padding: 16px;
}

.login-stack {
  display: grid;
  justify-items: center;
  gap: 22px;
  width: min(440px, 100%);
}

.login-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 16px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px 36px 32px;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #8B93FF);
}

.login-eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-card .mark {
  width: 44px;
  height: 44px;
  font-size: 15px;
  background: var(--accent);
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(88, 100, 255, 0.35);
}

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

.login-card .brand strong {
  font-family: var(--display-font);
  font-size: 18px;
}

.login-divider {
  height: 1px;
  margin: 2px 0;
  border: 0;
  background: var(--line);
}

.login-footer {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-align: center;
}

.login-status {
  margin: 0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  background: var(--status-success-bg);
  color: var(--status-success-text);
}

.login-status.error {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

.user-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.user-chip > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.user-chip strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip span {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.owner-hint {
  margin-top: 2px;
}

.users-card {
  min-width: min(680px, calc(100vw - 32px));
}

.users-roles {
  display: grid;
  gap: 2px;
  margin: 0;
  padding-left: 18px;
}

.users-new {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.users-new[open] {
  display: grid;
  gap: 10px;
}

.users-new summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.users-card {
  max-height: 92vh;
  overflow: auto;
}

.users-new-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 10px;
}

.users-new-fields label[hidden],
.users-new-section[hidden] {
  display: none;
}

.users-new-section {
  display: grid;
  gap: 6px;
}

.users-new-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.users-new-actions {
  display: flex;
  justify-content: flex-end;
}

.user-tableros {
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
  padding-right: 4px;
}

.user-tablero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-muted);
}

.user-tablero-titulo {
  display: grid;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-tablero-titulo small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.user-tablero select {
  width: 120px;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 11px;
  flex-shrink: 0;
}

.access-editor {
  display: grid;
  gap: 12px;
  width: 100%;
}

.access-section {
  display: grid;
  gap: 6px;
}

.access-empresas {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.access-modulo {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.access-modulo.is-on {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.access-modulo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}

.access-modulo-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
}

.access-modulo-check input,
.access-empresas input {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.access-modulo:not(.is-on) .access-modulo-body,
.access-modulo:not(.is-on) .access-crear {
  display: none;
}


/* Indicador "Puede crear tableros": interruptor junto al nombre del modulo. */
.access-crear {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* Casilla real oculta detras del interruptor: sin el width:100% global de los input, que la
   estiraba al ancho del dialogo y generaba scroll horizontal. */
.access-crear input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

/* Con un editor de accesos abierto la lista crece y se desplaza el dialogo completo. */
.users-list-tall:has(.user-tableros-editor) {
  max-height: none;
  overflow: visible;
}

.access-crear-switch {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: #c7c7cd;
  transition: background 0.15s ease;
}

.access-crear-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.access-crear input:checked + .access-crear-switch {
  background: var(--status-success-text);
}

.access-crear input:checked + .access-crear-switch::after {
  transform: translateX(13px);
}

.access-crear input:focus-visible + .access-crear-switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.access-crear-texto::after {
  content: "No crea tableros";
  color: var(--muted);
}

.access-crear input:checked ~ .access-crear-texto::after {
  content: "Puede crear tableros";
  color: var(--status-success-text);
}

@media (prefers-reduced-motion: reduce) {
  .access-crear-switch,
  .access-crear-switch::after {
    transition: none;
  }
}

.user-tableros-editor {
  display: grid;
  gap: 8px;
  justify-items: end;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.user-tableros-editor .user-tableros {
  width: 100%;
}

/* En la fila del usuario el editor ocupa todo el ancho (debajo del nombre y de los botones). */
.user-row > .user-tableros-editor {
  grid-column: 1 / -1;
}

.users-card {
  overflow-x: hidden;
}

.user-row,
.user-row-main,
.access-modulo {
  min-width: 0;
}

.user-tableros-editor button {
  min-height: 30px;
  font-size: 11px;
}

.link-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  text-decoration: underline;
}

.users-list-tall {
  max-height: min(420px, 55vh);
}

.user-row-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.user-row-head {
  flex-wrap: wrap;
}

.user-row-meta {
  color: var(--muted);
  font-size: 11px;
}

.user-row-modules {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.user-module {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.user-module input {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.user-row-note {
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
}

.permission-pill.rol-superusuario {
  background: var(--accent);
  color: #fff;
}

.permission-pill.rol-administrador {
  background: var(--accent-tint);
  color: var(--accent);
}

.permission-pill.rol-usuario {
  background: var(--surface-muted);
  color: var(--text);
}

.user-row.is-inactive {
  background: var(--surface-muted);
}

.user-row.is-inactive .user-row-head strong {
  color: var(--muted);
  text-decoration: line-through;
}

.user-row-actions select {
  width: auto;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 11px;
}

.user-row-actions .user-deactivate {
  color: var(--status-danger-text);
}

.share-owner-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.share-owner-row .hint {
  grid-column: 1 / -1;
  order: 3;
}

@media (max-width: 640px) {
  .users-new-fields,
  .share-owner-row {
    grid-template-columns: 1fr;
  }

  .user-row {
    grid-template-columns: 1fr;
  }
}

.users-add-row,
.users-grant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

.users-add-row legend,
.users-grant-row legend {
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  padding: 0 5px;
}

.users-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.user-row-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.user-row-head strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.permission-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  background: var(--status-success-bg);
  color: var(--status-success-text);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  margin: 2px 4px 0 0;
}

.permission-pill.view-only {
  background: var(--surface-muted);
  color: var(--muted);
}

.permission-pill button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: 900;
  min-height: auto;
  padding: 0 0 0 4px;
}

.user-row-actions {
  display: flex;
  gap: 6px;
}

.user-row-actions button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.budget-status {
  border: 1px solid #e4e8df;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  min-height: 40px;
  padding: 10px;
  white-space: pre-line;
}

.budget-status.good {
  border-color: var(--status-success-border);
  background: var(--status-success-bg);
  color: var(--status-success-text);
}

.budget-status.bad {
  border-color: var(--status-danger-border);
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

.budget-loads {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.compact-title {
  margin: 0;
}

.compact-title h2 {
  font-size: 14px;
}

.budget-loads-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.budget-load-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(210px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #e3e8df;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px;
}

.load-main,
.load-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.load-main strong,
.load-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.load-main small {
  color: var(--muted);
  font-size: 11px;
}

.load-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.load-warning {
  color: var(--status-danger-text);
}

.danger-button {
  color: var(--status-danger-text);
}

.icon-button {
  min-height: 30px;
  width: 32px;
  padding: 0;
}

@media (max-width: 1180px) {
  .app-body {
    grid-template-columns: minmax(0, 1fr) 260px;
  }
}

@media (max-width: 860px) {
  .app-sidebar {
    --sidebar-w: 56px;
    padding: 12px 0;
  }

  .sidebar-brand {
    width: 32px;
    height: 32px;
    margin-bottom: 14px;
  }

  .sidebar-link {
    width: 36px;
    height: 36px;
  }

  .app-body,
  .app-body.panel-collapsed {
    grid-template-columns: 1fr;
  }

  .inspector {
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .app-body.panel-collapsed .inspector {
    display: none;
  }

  .ribbon-top {
    flex-wrap: wrap;
  }

  .ribbon-tabs {
    order: 3;
    flex-basis: 100%;
  }

  .sheetbar {
    flex-direction: column;
    align-items: stretch;
  }

  .budget-options {
    grid-template-columns: 1fr;
  }

  .budget-load-row {
    grid-template-columns: 1fr;
  }

  .load-meta {
    grid-template-columns: 1fr;
  }

  .canvas {
    min-height: 760px;
  }

  .visual {
    left: 12px !important;
    width: calc(100% - 24px) !important;
  }
}
