:root {
  --ink: #101217;
  --muted: #707684;
  --paper: #f5f0e8;
  --panel: rgba(255, 252, 245, 0.86);
  --panel-solid: #fffaf1;
  --line: rgba(16, 18, 23, 0.12);
  --accent: #f59f2f;
  --accent-dark: #d88410;
  --green: #11181c;
  --blue: #11181c;
  --shadow: 0 24px 80px rgba(31, 24, 15, 0.16);
  --widget-close-surface: #fffaf1;
  --widget-close-icon: #27313f;
  --widget-close-border: #808894;
  --widget-close-focus-dark: #101217;
  --widget-close-focus-light: #ffffff;
}

/* Persistent alert configuration and global notification rail */
.configuration-section-tabs {
  display: flex;
  gap: 8px;
  width: fit-content;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid rgba(43, 49, 47, 0.12);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.82);
}

.configuration-section-tab {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #5f6662;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.configuration-section-tab:hover,
.configuration-section-tab:focus-visible {
  color: #1e2925;
  background: rgba(232, 237, 232, 0.8);
}

.configuration-section-tab.is-active {
  color: #f8f5ec;
  background: #16211e;
  box-shadow: 0 7px 18px rgba(14, 27, 23, 0.16);
}

.configuration-section-tab:disabled,
.configuration-section-tab[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: .48;
  color: #7d837f;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.configuration-section-tab:disabled:hover,
.configuration-section-tab:disabled:focus-visible,
.configuration-section-tab[aria-disabled="true"]:hover,
.configuration-section-tab[aria-disabled="true"]:focus-visible {
  color: #7d837f;
  background: transparent;
  box-shadow: none;
}

.configuration-section-tab .ui-icon {
  margin-right: 7px;
  vertical-align: -2px;
}

.configuration-section-panel:not(.is-active) {
  display: none;
}

/* Alert settings design tokens. Keep sizing and spacing changes centralized here. */
#config-panel-alerts {
  --alert-control-height: 44px;
  --alert-rule-control-height: 40px;
  --alert-control-radius: 10px;
  --alert-panel-radius: 14px;
  --alert-field-gap: 7px;
  --alert-inline-gap: 8px;
  --alert-section-gap: 12px;
  --alert-label-line-height: 16px;
  --alert-border: rgba(42, 49, 46, 0.12);
  --alert-control-border: #cbcfc9;
  --alert-text: #202824;
  --alert-muted: #68706c;
  --alert-surface: #fff;
  --alert-soft-surface: #f5f3ec;
}

.configuration-alerts-heading,
.configuration-alert-module-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.configuration-alerts-heading {
  padding: 22px 24px;
  border: 1px solid var(--alert-border, rgba(42, 49, 46, 0.12));
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 253, 247, 0.98), rgba(243, 239, 226, 0.94));
}

.configuration-alerts-heading h2,
.configuration-alert-module-heading h3 {
  margin: 0 0 3px;
  color: #202824;
}

.configuration-alerts-heading-plain {
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.configuration-alerts-heading p,
.configuration-alert-module-heading p {
  margin: 0;
  color: var(--alert-muted, #68706c);
  line-height: 1.4;
}

.configuration-alert-status,
.configuration-alert-rule-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: #eee9de;
  color: #746b5c;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.configuration-alert-status.is-enabled {
  color: #176044;
  background: #dff2e9;
}

.configuration-alert-workspace {
  margin-top: 8px;
}

.configuration-alert-module-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  border-bottom: 1px solid var(--alert-border, rgba(42, 49, 46, 0.12));
}

.configuration-alert-module-tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--alert-control-radius, 10px);
  color: #56605a;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.configuration-alert-module-tab:hover,
.configuration-alert-module-tab:focus-visible {
  border-color: #b8c4bb;
  background: #f3f5f1;
}

.configuration-alert-module-tab.is-active {
  color: #f9f6ed;
  border-color: #16211e;
  background: #16211e;
}

.configuration-alert-type-area {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  align-items: end;
  gap: 16px;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--alert-border, rgba(42, 49, 46, 0.12));
  border-radius: var(--alert-panel-radius, 14px);
  background: rgba(255, 253, 248, 0.72);
}

.configuration-alert-type-selector,
.configuration-alert-create label,
.configuration-alert-rule-controls > label {
  color: #4d5651;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: var(--alert-label-line-height, 16px);
}

.configuration-alert-type-selector {
  display: grid;
  gap: var(--alert-field-gap, 7px);
}

.configuration-alert-type-selector select,
.configuration-alert-create input,
.configuration-alert-rule-controls input[type="number"] {
  width: 100%;
  height: var(--alert-control-height, 44px);
  min-height: var(--alert-control-height, 44px);
  padding: 0 12px;
  border: 1px solid var(--alert-control-border, #cbcfc9);
  border-radius: var(--alert-control-radius, 10px);
  color: var(--alert-text, #202824);
  background: var(--alert-surface, #fff);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
}

.configuration-alert-type-selector select:focus-visible,
.configuration-alert-create input:focus-visible,
.configuration-alert-rule-controls input[type="number"]:focus-visible {
  border-color: #8b9890;
  outline: 3px solid rgba(245, 159, 47, 0.18);
  outline-offset: 1px;
}

.configuration-alert-type-description {
  display: flex;
  align-items: center;
  min-height: var(--alert-control-height, 44px);
  padding: 0 2px;
  color: #69716c;
  font-size: 0.82rem;
  line-height: 1.4;
}

.configuration-alert-module {
  margin-top: var(--alert-section-gap, 12px);
  padding: 16px;
  border: 1px solid var(--alert-border, rgba(42, 49, 46, 0.12));
  border-radius: var(--alert-panel-radius, 14px);
  background: rgba(255, 255, 252, 0.94);
}

.configuration-alert-module-heading > div {
  min-width: 0;
}

.configuration-alert-module-compact .configuration-alert-module-heading {
  display: none;
}

.configuration-alert-module-compact .configuration-alert-create {
  margin-top: 0;
}

.configuration-alert-module-heading > div > span {
  color: #d5811a;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.configuration-alert-module-heading h3 {
  margin: 2px 0 3px;
}

.configuration-alert-formula {
  align-self: flex-start;
  max-width: 330px;
  padding: 8px 11px;
  border: 1px solid rgba(213, 129, 26, 0.23);
  border-radius: var(--alert-control-radius, 10px);
  color: #865713;
  background: #fff7e8;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.35;
}

.configuration-alert-create {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px max-content;
  align-items: start;
  column-gap: 12px;
  row-gap: var(--alert-inline-gap, 8px);
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--alert-panel-radius, 14px);
  background: var(--alert-soft-surface, #f5f3ec);
}

.configuration-alert-create-single {
  grid-template-columns: minmax(320px, 560px) max-content;
  justify-content: space-between;
  align-items: start;
}

.configuration-alert-create-single > label {
  width: 100%;
  max-width: 560px;
}

.configuration-alert-create-single .configuration-alert-percent {
  width: 138px;
  max-width: 100%;
}

.configuration-alert-create label,
.configuration-alert-rule-controls > label {
  display: grid;
  gap: var(--alert-field-gap, 7px);
}

.configuration-alert-create label {
  align-content: start;
  min-width: 0;
}

.configuration-alert-create > .primary-button {
  align-self: start;
  height: var(--alert-control-height, 44px);
  min-height: var(--alert-control-height, 44px);
  margin-top: calc(var(--alert-label-line-height, 16px) + var(--alert-field-gap, 7px));
  padding: 0 18px;
  border-radius: var(--alert-control-radius, 10px);
  line-height: 1;
  white-space: nowrap;
}

.configuration-alert-module[data-alert-adapter="production-confirmation-overdue"] .configuration-alert-create > .primary-button {
  margin-top: 0;
}

.configuration-alert-create > .primary-button:disabled {
  color: #969c98;
  background: #e5e4df;
  box-shadow: inset 0 0 0 1px #d3d5d0;
  cursor: default;
  opacity: 1;
  transform: none;
}

.configuration-alert-create > .primary-button:disabled:hover {
  box-shadow: inset 0 0 0 1px #d3d5d0;
  transform: none;
}

.configuration-alert-create small {
  display: block;
  color: #7a817d;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
}

.configuration-alert-article-picker {
  position: relative;
}

.configuration-alert-create .configuration-alert-article-search {
  margin-bottom: 0;
  border-color: var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 850;
}

.configuration-alert-create .configuration-alert-article-search:focus-visible {
  border-color: rgba(255, 106, 42, 0.65);
  outline: none;
  box-shadow: 0 0 0 4px rgba(255, 106, 42, 0.12);
}

.configuration-alert-article-hint {
  margin: -1px 0 0;
  font-weight: 700;
}

.configuration-alert-article-results {
  align-content: flex-start;
  max-height: 112px;
  margin-top: -1px;
  padding: 2px 4px 2px 0;
}

.configuration-alert-article-option {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  text-align: left;
}

.configuration-alert-article-option span {
  min-height: 30px;
}

.configuration-alert-article-option:focus-visible {
  outline: none;
}

.configuration-alert-article-option:focus-visible span {
  box-shadow: 0 0 0 3px rgba(255, 106, 42, 0.20);
}

.configuration-alert-percent {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  height: var(--alert-control-height, 44px);
}

.configuration-alert-percent input {
  min-width: 0;
  border-radius: var(--alert-control-radius, 10px) 0 0 var(--alert-control-radius, 10px);
}

.configuration-alert-percent span {
  display: grid;
  min-width: 44px;
  height: var(--alert-control-height, 44px);
  padding: 0 10px;
  place-items: center;
  border: 1px solid var(--alert-control-border, #cbcfc9);
  border-left: 0;
  border-radius: 0 var(--alert-control-radius, 10px) var(--alert-control-radius, 10px) 0;
  color: #695c45;
  background: #eee9dd;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.configuration-alert-feedback {
  min-height: 0;
  margin: 8px 2px 0;
  color: #176044;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 20px;
}

.configuration-alert-feedback:empty {
  display: none;
}

.configuration-alert-feedback.is-error,
.configuration-alert-empty.is-error {
  color: #aa3529;
}

.configuration-alert-rules {
  display: grid;
  gap: var(--alert-section-gap, 12px);
  margin-top: 8px;
}

.configuration-alert-rule-group {
  display: grid;
  gap: 7px;
}

.configuration-alert-rule-group > h3 {
  margin: 0;
  color: #3b4740;
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1.3;
}

.configuration-alert-rule-list {
  display: grid;
  gap: 6px;
}

.configuration-alert-rule {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 9px 12px 9px 14px;
  border: 1px solid #dedfd9;
  border-left: 4px solid #9ba59f;
  border-radius: var(--alert-control-radius, 10px);
  background: #fff;
}

.configuration-alert-rule.is-breach {
  border-left-color: #bd3d2e;
  background: #fffaf8;
}

.configuration-alert-rule-identity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.configuration-alert-rule-identity strong,
.configuration-alert-rule-identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.configuration-alert-rule-identity strong {
  color: #27312c;
  font-size: 0.8rem;
  line-height: 1.3;
}

.configuration-alert-rule-identity small {
  color: #747c77;
  font-size: 0.72rem;
  line-height: 1.35;
}

.configuration-alert-rule-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.configuration-alert-rule-state {
  min-height: 30px;
  padding-inline: 10px;
  font-size: 0.7rem;
}

.configuration-alert-rule-controls input[type="number"] {
  width: 62px;
  height: var(--alert-rule-control-height, 40px);
  min-height: var(--alert-rule-control-height, 40px);
  padding-inline: 9px;
}

.configuration-alert-rule-controls > .configuration-alert-inline-control,
.configuration-alert-rule-controls > .configuration-alert-toggle {
  display: inline-flex;
  align-items: center;
  min-height: var(--alert-rule-control-height, 40px);
  gap: 7px;
  line-height: 1;
}

.configuration-alert-rule-controls > .configuration-alert-inline-control {
  flex: 0 0 auto;
}

.configuration-alert-toggle {
  cursor: pointer;
  white-space: nowrap;
}

.configuration-alert-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #1d6a4d;
}

.configuration-alert-rule-controls .ghost-button {
  height: var(--alert-rule-control-height, 40px);
  min-height: var(--alert-rule-control-height, 40px);
  padding: 0 11px;
  border-radius: var(--alert-control-radius, 10px);
  font-size: 0.76rem;
  line-height: 1;
  white-space: nowrap;
}

.configuration-alert-rule-controls .configuration-alert-save-button:disabled {
  color: #9ba09c;
  background: #f1f0ec;
  box-shadow: inset 0 0 0 1px #dedfd9;
  cursor: default;
  opacity: 0.72;
  transform: none;
}

.configuration-alert-rule-controls .configuration-alert-save-button:disabled:hover {
  transform: none;
  box-shadow: inset 0 0 0 1px #dedfd9;
}

.configuration-alert-empty {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  padding: 18px;
  border: 1px dashed #c9ccc6;
  border-radius: var(--alert-panel-radius, 14px);
  color: #6d746f;
  background: rgba(250, 249, 245, 0.8);
  line-height: 1.4;
}

.configuration-alert-rules > .configuration-alert-empty {
  margin-top: 0;
}

@media (max-width: 880px) {
  .configuration-alert-type-area {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .configuration-alert-type-description {
    min-height: 0;
  }

  .configuration-alert-create,
  .configuration-alert-create-single,
  .configuration-alert-rule {
    grid-template-columns: 1fr;
  }

  .configuration-alert-create > .primary-button {
    width: 100%;
    margin-top: 0;
  }

  .configuration-alert-rule-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .configuration-alert-rule-controls .ghost-button {
    flex: 1 1 112px;
  }
}

@media (max-width: 620px) {
  .configuration-section-tabs {
    width: 100%;
  }

  .configuration-section-tab {
    flex: 1;
  }

  .configuration-alerts-heading,
  .configuration-alert-module-heading {
    display: grid;
    gap: 10px;
  }

  .configuration-alert-module {
    padding: 14px;
  }

  .configuration-alert-create {
    padding: 12px;
  }

  .configuration-alert-type-area {
    padding: 11px 12px;
  }

  .configuration-alert-module-tabs {
    margin-inline: -2px;
  }

  .configuration-alert-rule-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .configuration-alert-rule-state {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .configuration-alert-rule-controls > .configuration-alert-inline-control,
  .configuration-alert-rule-controls > .configuration-alert-toggle {
    width: 100%;
  }

  .configuration-alert-rule-controls > .configuration-alert-inline-control {
    justify-content: space-between;
  }

  .configuration-alert-rule-controls > .configuration-alert-toggle {
    justify-content: flex-start;
  }

  .configuration-alert-rule-controls .ghost-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .configuration-section-tab {
    transition: none;
  }
}

 .dashboard-alert-rail {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  width: min(324px, calc(100vw - 32px));
  max-height: min(430px, calc(100vh - 32px));
  overflow: hidden;
  border: 1px solid rgba(31, 41, 37, 0.18);
  border-radius: 14px;
  background: rgba(250, 248, 241, 0.98);
  box-shadow: 0 14px 34px rgba(13, 24, 20, 0.22);
}

.dashboard-alert-rail[hidden] {
  display: none;
}

.dashboard-alert-rail:focus-visible {
  outline: 3px solid #e79a38;
  outline-offset: 3px;
}

.dashboard-alert-rail > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  color: #f9f5ea;
  background: #15211d;
}

.dashboard-alert-heading {
  display: grid;
  gap: 0;
  min-width: 0;
}

.dashboard-alert-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.dashboard-alert-rail > header .eyebrow {
  color: #e79a38;
  font-size: 0.66rem;
}

.dashboard-alert-rail > header strong {
  font-size: 0.84rem;
}

.dashboard-alert-count {
  display: grid;
  min-width: 28px;
  min-height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #70231b;
  background: #ffd9d2;
  font-size: 0.78rem;
  font-weight: 900;
}

.dashboard-alert-window-action {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(249, 245, 234, 0.22);
  border-radius: 50%;
  color: #f9f5ea;
  background: transparent;
  font: inherit;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.dashboard-alert-window-action:hover,
.dashboard-alert-window-action:focus-visible {
  border-color: rgba(249, 245, 234, 0.52);
  background: rgba(249, 245, 234, 0.1);
}

.dashboard-alert-window-action:focus-visible,
.dashboard-alert-restore:focus-visible {
  outline: 3px solid #e79a38;
  outline-offset: 2px;
}

.dashboard-alert-dismiss-all:hover,
.dashboard-alert-dismiss-all:focus-visible {
  color: #ffd9d2;
  border-color: rgba(255, 217, 210, 0.6);
  background: rgba(196, 63, 48, 0.2);
}

.dashboard-alert-window-action:disabled {
  cursor: wait;
  opacity: 0.55;
}

.dashboard-alert-window-action[hidden] {
  display: none;
}

.dashboard-alert-restore {
  display: none;
  width: 52px;
  height: 52px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(231, 154, 56, 0.5);
  border-radius: 50%;
  color: #f5a33c;
  background: #15211d;
  box-shadow: 0 12px 28px rgba(13, 24, 20, 0.24);
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.dashboard-alert-restore .ui-icon {
  width: 21px;
  height: 21px;
}

.dashboard-alert-restore:hover,
.dashboard-alert-restore:focus-visible {
  background: #1d2b26;
  transform: translateY(-1px);
}

.dashboard-alert-rail.is-minimized {
  width: 52px;
  height: 52px;
  max-height: none;
  overflow: visible;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.dashboard-alert-rail.is-minimized > header,
.dashboard-alert-rail.is-minimized > .dashboard-alert-error,
.dashboard-alert-rail.is-minimized > .dashboard-alert-list {
  display: none;
}

.dashboard-alert-rail.is-minimized .dashboard-alert-restore {
  display: grid;
}

.dashboard-alert-list {
  display: grid;
  gap: 6px;
  max-height: 352px;
  padding: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dashboard-alert-error,
.dashboard-alert-empty-state {
  margin: 7px 7px 0;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 0.76rem;
}

.dashboard-alert-error {
  color: #7e2119;
  background: #fde8e4;
}

.dashboard-alert-error[hidden] {
  display: none;
}

.dashboard-alert-empty-state {
  margin: 0;
  color: #59625d;
  background: #f1efe8;
}

.dashboard-alert-card {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid #e1d9ce;
  border-left: 3px solid #c43f30;
  border-radius: 10px;
  background: #fffdf8;
}

.dashboard-alert-card > div:first-child {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.dashboard-alert-card > div:first-child > strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-alert-card > div:first-child > span,
.dashboard-alert-card time {
  color: #777a74;
  font-size: 0.68rem;
}

.dashboard-alert-card p {
  margin: 0;
  color: #5d4a43;
  font-size: 0.76rem;
  line-height: 1.3;
}

.dashboard-alert-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.dashboard-alert-view,
.dashboard-alert-dismiss {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.dashboard-alert-view {
  color: #174d42;
  background: #e8f2ec;
}

.dashboard-alert-dismiss {
  color: #6d5049;
  background: transparent;
}

.dashboard-alert-view:hover,
.dashboard-alert-view:focus-visible {
  border-color: #4f8878;
  background: #d8ebe1;
}

.dashboard-alert-dismiss:hover,
.dashboard-alert-dismiss:focus-visible {
  color: #8e291f;
  border-color: #e3c1ba;
  background: #f8e7e3;
}

.dashboard-alert-view:focus-visible,
.dashboard-alert-dismiss:focus-visible {
  outline: 3px solid #e79a38;
  outline-offset: 2px;
}

.dashboard-alert-view[hidden] {
  display: none;
}

.dashboard-alert-view:disabled {
  cursor: default;
  opacity: 0.5;
}

@media (max-width: 620px) {
  .dashboard-alert-rail {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(324px, calc(100vw - 24px));
    max-height: min(390px, calc(100vh - 24px));
  }

  .dashboard-alert-list {
    max-height: 312px;
  }

  .dashboard-alert-rail > header {
    gap: 8px;
    padding-inline: 10px;
  }

}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 15px;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Manrope, Verdana, sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 106, 42, 0.20), transparent 28rem),
    radial-gradient(circle at 92% 2%, rgba(32, 63, 136, 0.16), transparent 24rem),
    linear-gradient(135deg, #f7efe2 0%, #eee4d4 50%, #f8f3ea 100%);
}

body.modal-open {
  overflow: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(16, 18, 23, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 18, 23, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
}

a {
  color: inherit;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px clamp(16px, 3vw, 42px) 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 250, 241, 0.72);
  box-shadow: 0 12px 50px rgba(31, 24, 15, 0.10);
  backdrop-filter: blur(18px);
}

.brand {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.04em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.78rem;
}

.content-wrap {
  min-height: calc(100vh - 48px);
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.user-pill,
.metric-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.82rem;
  font-weight: 700;
}

.ghost-button,
.primary-button {
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ghost-button {
  padding: 8px 15px;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.primary-button {
  width: 100%;
  padding: 14px 18px;
  color: #fffaf1;
  background: linear-gradient(135deg, var(--ink), var(--green));
  box-shadow: 0 16px 34px rgba(16, 18, 23, 0.20);
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(16, 18, 23, 0.18);
}

.login-screen {
  display: grid;
  min-height: calc(100vh - 70px);
  place-items: center;
  padding: clamp(10px, 2vw, 24px) 0;
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(340px, 0.84fr);
  width: min(1120px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 38px;
  background: rgba(255, 250, 241, 0.72);
  box-shadow: 0 34px 110px rgba(31, 24, 15, 0.18);
  backdrop-filter: blur(20px);
}

.login-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  min-height: 550px;
  padding: clamp(34px, 5vw, 64px);
  color: #fffaf1;
  background:
    radial-gradient(circle at 74% 20%, rgba(255, 106, 42, 0.36), transparent 17rem),
    radial-gradient(circle at 22% 88%, rgba(32, 63, 136, 0.30), transparent 20rem),
    linear-gradient(145deg, #030504 0%, #0b1715 48%, #11110f 100%);
}

.login-copy::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(255, 250, 241, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 250, 241, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at 62% 52%, #000, transparent 76%);
}

.login-copy::after {
  position: absolute;
  right: -74px;
  bottom: -150px;
  z-index: 0;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 250, 241, 0.14);
  border-radius: 50%;
  content: "";
}

.login-copy .eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 16px;
  color: #f89721;
  font-size: clamp(1.1rem, 1.7vw, 1.45rem);
  letter-spacing: 0.08em;
}

.login-brand-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 22px);
  width: min(100%, 520px);
  margin-bottom: 22px;
}

.login-brand-lockup img {
  width: clamp(118px, 13vw, 156px);
  height: auto;
  flex: 0 0 auto;
  border-radius: 18px;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.32));
  mix-blend-mode: screen;
}

.login-copy h1,
.hero-panel h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 5.6rem);
  font-weight: 700;
  letter-spacing: -0.07em;
  line-height: 0.9;
}

.login-copy h1 {
  position: relative;
  z-index: 1;
  max-width: 410px;
}

.monark-wordmark {
  font-family: Manrope, Arial, sans-serif;
  text-transform: none;
  width: min(100%, 390px);
}

.monark-wordmark span,
.monark-wordmark strong {
  display: block;
  color: #fffaf1;
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 0.92;
  text-shadow: 0 18px 52px rgba(0, 0, 0, 0.5);
}

.monark-wordmark span {
  font-size: clamp(2.9rem, 4vw, 4.65rem);
}

.monark-wordmark strong {
  font-size: clamp(2.85rem, 3.85vw, 4.5rem);
  letter-spacing: -0.04em;
}

.login-copy p:not(.eyebrow) {
  position: relative;
  z-index: 1;
}

.login-copy p:not(.eyebrow),
.hero-text {
  max-width: 560px;
  margin: 24px 0 0;
  color: rgba(255, 250, 241, 0.74);
  font-size: 1rem;
  line-height: 1.7;
}

.login-dashboard-visual {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  min-height: 170px;
  margin-top: 30px;
  padding: 16px;
  border: 1px solid rgba(255, 250, 241, 0.16);
  border-radius: 28px;
  background: rgba(255, 250, 241, 0.10);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(14px);
}

.login-visual-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
}

.login-visual-header span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.40);
}

.login-visual-header span:first-child {
  background: #ff8650;
}

.login-visual-metrics {
  display: grid;
  grid-template-columns: 1fr 0.78fr;
  gap: 10px;
  margin-bottom: 12px;
}

.login-visual-metrics span {
  display: grid;
  gap: 8px;
  min-height: 46px;
  padding: 11px 12px;
  border-radius: 15px;
  background: rgba(255, 250, 241, 0.13);
  box-shadow: inset 0 0 0 1px rgba(255, 250, 241, 0.08);
}

.login-visual-metrics b,
.login-visual-metrics i {
  display: block;
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.34);
}

.login-visual-metrics b {
  width: 42%;
  height: 7px;
}

.login-visual-metrics i {
  width: 72%;
  height: 10px;
  background: rgba(255, 134, 80, 0.68);
}

.login-visual-chart {
  position: relative;
  height: 82px;
  overflow: hidden;
  border: 1px solid rgba(255, 250, 241, 0.10);
  border-radius: 20px;
  background:
    linear-gradient(rgba(255, 250, 241, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 250, 241, 0.05) 1px, transparent 1px),
    rgba(16, 18, 23, 0.16);
  background-size: 100% 28px, 52px 100%, auto;
}

.login-visual-chart svg {
  position: absolute;
  inset: 10px 12px 8px;
  width: calc(100% - 24px);
  height: calc(100% - 18px);
}

.login-chart-area {
  fill: rgba(255, 134, 80, 0.22);
}

.login-chart-line {
  fill: none;
  stroke: #ff8650;
  stroke-linecap: round;
  stroke-width: 5;
}

.login-chart-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 250, 241, 0.85);
  border-radius: 999px;
  background: #ff8650;
  box-shadow: 0 0 18px rgba(255, 134, 80, 0.70);
}

.login-chart-dot-a {
  left: 30%;
  top: 36%;
}

.login-chart-dot-b {
  left: 61%;
  top: 25%;
}

.login-chart-dot-c {
  right: 9%;
  top: 31%;
}

.login-visual-line {
  position: absolute;
  right: 18px;
  bottom: 42px;
  left: 18px;
  height: 44px;
  border-top: 2px solid rgba(127, 183, 255, 0.48);
  border-right: 2px solid rgba(127, 183, 255, 0.30);
  border-radius: 0 24px 0 0;
  pointer-events: none;
}

.login-form {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 550px;
  padding: clamp(34px, 5vw, 62px);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 106, 42, 0.10), transparent 16rem),
    rgba(255, 250, 241, 0.68);
}

.login-form::before {
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 30px;
  content: "";
  pointer-events: none;
}

.login-form label {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-form input {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid rgba(16, 18, 23, 0.12);
  border-radius: 18px;
  outline: none;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 30px rgba(31, 24, 15, 0.06);
  font-weight: 750;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.login-form input:focus {
  border-color: rgba(255, 106, 42, 0.65);
  background: #fffaf1;
  box-shadow: 0 0 0 4px rgba(255, 106, 42, 0.12), 0 16px 40px rgba(31, 24, 15, 0.10);
}

.login-form .primary-button {
  position: relative;
  z-index: 1;
  min-height: 52px;
  margin-top: 18px;
  letter-spacing: 0.02em;
}

.validation-summary,
.field-error {
  position: relative;
  z-index: 1;
  color: #a63820;
  font-size: 0.86rem;
  font-weight: 700;
}

.login-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ui-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 1.05em;
  height: 1.05em;
  background: currentColor;
  vertical-align: -0.15em;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon-chart {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M4 19V5M4 19h16M8 16v-5M12 16V8M16 16v-9'/%3E%3C/svg%3E");
}

.icon-box {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M4 8.5 12 4l8 4.5v7L12 20l-8-4.5v-7Zm8 11.5v-8M4.5 8.8 12 13l7.5-4.2'/%3E%3C/svg%3E");
}

.icon-factory {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3 20h18M4 20V9l5 3V9l5 3V5h5v15M7 16h2M12 16h2M17 16h1M17 8h2'/%3E%3C/svg%3E");
}

.icon-users {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M9 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm9 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM3.5 19c.7-3.2 2.6-5 5.5-5s4.8 1.8 5.5 5M14.5 18.5c.6-2 1.8-3.1 3.5-3.1 1.8 0 3 1.1 3.5 3.1'/%3E%3C/svg%3E");
}

.icon-calendar {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M7 3v4M17 3v4M4 9h16M5 5h14a1 1 0 0 1 1 1v14H4V6a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E");
}

.icon-network {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M12 5a3 3 0 1 0 0 6 3 3 0 0 0 0-6ZM5 15a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm14 0a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm-5.2-5.2 3.1 5.4M10.2 9.8l-3.1 5.4M8 18h8'/%3E%3C/svg%3E");
}

.icon-truck {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3 6h11v10H3V6Zm11 3h4l3 4v3h-7V9ZM6.5 19a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm11 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM14 13h7'/%3E%3C/svg%3E");
}

.icon-map-pin {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round' d='M12 21s7-5.1 7-12a7 7 0 1 0-14 0c0 6.9 7 12 7 12Zm0-9.2a2.8 2.8 0 1 0 0-5.6 2.8 2.8 0 0 0 0 5.6Z'/%3E%3C/svg%3E");
}

.icon-trophy {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M8 4h8v4a4 4 0 1 1-8 0V4Zm1 14h6M12 12v6M8 6H5v2a4 4 0 0 0 3.5 4M16 6h3v2a4 4 0 0 1-3.5 4'/%3E%3C/svg%3E");
}

.icon-stack {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='m12 4 8 4-8 4-8-4 8-4Zm-6 8 6 3 6-3M6 16l6 3 6-3'/%3E%3C/svg%3E");
}

.icon-settings {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round' d='M12 8.2a3.8 3.8 0 1 0 0 7.6 3.8 3.8 0 0 0 0-7.6Zm7.1 3.8c0-.5-.1-1-.2-1.5l2-1.5-2-3.4-2.4 1a7.8 7.8 0 0 0-2.6-1.5L13.6 2h-4l-.3 3.1a7.8 7.8 0 0 0-2.6 1.5l-2.4-1-2 3.4 2 1.5a7 7 0 0 0 0 3L2.3 15l2 3.4 2.4-1a7.8 7.8 0 0 0 2.6 1.5l.3 3.1h4l.3-3.1a7.8 7.8 0 0 0 2.6-1.5l2.4 1 2-3.4-2-1.5c.1-.5.2-1 .2-1.5Z'/%3E%3C/svg%3E");
}

.icon-search {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' d='m20 20-4.5-4.5M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z'/%3E%3C/svg%3E");
}

.icon-wallet {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M4 7h16v12H4V7Zm0 0 10-3h3v3M16 13h4'/%3E%3C/svg%3E");
}

.icon-money-bag {
  --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20d%3D%27M9.4%206.4c.9-.8%201.6-1.8%202-2.9h1.2c.4%201.1%201.1%202.1%202%202.9M9.5%206.5h5M10%209.2c-2.7%201-4.5%203.2-4.5%206%200%203.6%202.9%206.5%206.5%206.5s6.5-2.9%206.5-6.5c0-2.8-1.8-5-4.5-6M12%2010.2v6.6M13.8%2011.8c-.4-.6-1-.9-1.8-.9-1.1%200-1.9.6-1.9%201.5%200%20.8.6%201.3%201.9%201.7%201.3.4%201.9.9%201.9%201.8%200%201-.8%201.7-2%201.7-.9%200-1.7-.4-2.1-1.1%27%20%2F%3E%3C%2Fsvg%3E");
}

.icon-pulse {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3 12h4l2-6 4 12 2-6h6'/%3E%3C/svg%3E");
}

.icon-alert {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M12 3 22 20H2L12 3Z M12 9v5 M12 17.5h.01'/%3E%3C/svg%3E");
}

.icon-document {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M6 3h8l4 4v14H6V3Zm8 0v5h4M9 12h6M9 16h6'/%3E%3C/svg%3E");
}

.icon-book {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M4.5 5.5A2.5 2.5 0 0 1 7 3h4.5v16H7a2.5 2.5 0 0 0-2.5 2.5V5.5Zm15 0A2.5 2.5 0 0 0 17 3h-5.5v16H17a2.5 2.5 0 0 1 2.5 2.5V5.5ZM8 7h2M14 7h2'/%3E%3C/svg%3E");
}

.icon-ledger {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M5 3h12l2 2v16H5V3Zm3 5h8M8 12h8M8 16h8M12 8v8'/%3E%3C/svg%3E");
}

.icon-receipt {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M6 3h12v18l-3-2-3 2-3-2-3 2V3Zm4 6h4M10 13h4'/%3E%3C/svg%3E");
}

.icon-envelope {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 6.5h17v11h-17v-11Zm.8.7L12 13l7.7-5.8M4.5 17l5-5M19.5 17l-5-5'/%3E%3C/svg%3E");
}

.icon-edit {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M4 20h4L19 9l-4-4L4 16v4Zm9.8-13.8 4 4M12.5 7.5l4 4'/%3E%3C/svg%3E");
}

.icon-send {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3 11.5 21 4l-6.5 16-3.2-6.2L3 11.5Zm8.3 2.3L21 4'/%3E%3C/svg%3E");
}

.icon-save {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M5 4h12l2 2v14H5V4Zm3 0v6h8V4M8 20v-6h8v6'/%3E%3C/svg%3E");
}

.icon-play {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M8 5.5v13l10-6.5L8 5.5Z'/%3E%3C/svg%3E");
}

.icon-pause {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' d='M9 6v12M15 6v12'/%3E%3C/svg%3E");
}

.icon-donut {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M12 3a9 9 0 1 0 9 9h-6a3 3 0 1 1-3-3V3Zm0 0v6m9 3h-6'/%3E%3C/svg%3E");
}

.icon-maximize {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M8 3H3v5M16 3h5v5M21 16v5h-5M3 16v5h5'/%3E%3C/svg%3E");
}

.icon-restore {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M9 3v6H3M15 3v6h6M21 15h-6v6M3 15h6v6'/%3E%3C/svg%3E");
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: 38px;
  background:
    radial-gradient(circle at 80% 30%, rgba(255, 106, 42, 0.18), transparent 20rem),
    rgba(255, 250, 241, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel h1 {
  color: var(--ink);
}

.hero-text {
  color: var(--muted);
}

.dashboard-hero {
  position: relative;
  grid-template-columns: minmax(0, 1.08fr) minmax(310px, 0.92fr);
  column-gap: 24px;
  row-gap: 12px;
  overflow: hidden;
  min-height: 230px;
  padding: clamp(18px, 2.5vw, 28px);
  color: #fffaf1;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 106, 42, 0.48), transparent 16rem),
    radial-gradient(circle at 100% 88%, rgba(32, 63, 136, 0.44), transparent 22rem),
    linear-gradient(135deg, #07110f 0%, #10261f 50%, #101217 100%);
  box-shadow: 0 30px 100px rgba(16, 18, 23, 0.28);
}

.hero-topline {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.hero-logout-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.hero-user-pill,
.hero-logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid rgba(255, 250, 241, 0.16);
  border-radius: 999px;
  color: rgba(255, 250, 241, 0.78);
  background: rgba(255, 250, 241, 0.08);
  font-size: 0.82rem;
  font-weight: 850;
}

.hero-logout-button {
  color: #101217;
  background: #fffaf1;
}

.dashboard-hero::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 250, 241, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 250, 241, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at 72% 48%, #000, transparent 72%);
}

.dashboard-hero::after {
  position: absolute;
  right: -120px;
  bottom: -190px;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(255, 250, 241, 0.13);
  border-radius: 999px;
  content: "";
}

.hero-copy,
.hero-visual {
  position: relative;
  z-index: 1;
}

.dashboard-hero .eyebrow {
  color: #ffb08b;
}

.dashboard-hero h1 {
  max-width: 780px;
  color: #fffaf1;
  font-size: clamp(2.35rem, 4.1vw, 4rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.dashboard-hero h1 span {
  display: block;
  color: #ff8650;
}

.dashboard-hero .hero-text {
  max-width: 680px;
  margin-top: 12px;
  color: rgba(255, 250, 241, 0.72);
  font-size: clamp(0.88rem, 0.95vw, 0.98rem);
  line-height: 1.45;
}

.hero-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.hero-context span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 250, 241, 0.14);
  border-radius: 999px;
  color: rgba(255, 250, 241, 0.78);
  background: rgba(255, 250, 241, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  font-weight: 800;
}

.hero-context strong {
  color: #fffaf1;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-visual {
  min-height: 180px;
}

.hero-orbit {
  position: absolute;
  inset: 0 4px 0 auto;
  width: min(260px, 100%);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 250, 241, 0.16);
  border-radius: 999px;
}

.hero-orbit::before,
.hero-orbit::after {
  position: absolute;
  inset: 16%;
  border: 1px dashed rgba(255, 250, 241, 0.14);
  border-radius: inherit;
  content: "";
}

.hero-orbit::after {
  inset: 34%;
  border-style: solid;
  background: radial-gradient(circle, rgba(255, 106, 42, 0.30), transparent 62%);
}

.hero-orbit span {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff8650;
  box-shadow: 0 0 24px rgba(255, 106, 42, 0.75);
}

.hero-orbit span:nth-child(1) {
  top: 18%;
  right: 14%;
}

.hero-orbit span:nth-child(2) {
  bottom: 24%;
  left: 10%;
  background: #d7a84b;
}

.hero-orbit span:nth-child(3) {
  right: 35%;
  bottom: 8%;
  background: #7fb7ff;
}

.hero-signal-card {
  position: absolute;
  right: 18px;
  bottom: 0;
  width: min(280px, calc(100% - 18px));
  padding: 12px;
  border: 1px solid rgba(255, 250, 241, 0.18);
  border-radius: 22px;
  background: rgba(255, 250, 241, 0.12);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(16px);
}

.signal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: rgba(255, 250, 241, 0.72);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.signal-header b {
  padding: 5px 8px;
  border-radius: 999px;
  color: #101217;
  background: #ff8650;
  font-size: 0.66rem;
}

.signal-bars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  gap: 7px;
  height: 64px;
}

.signal-bars i {
  display: block;
  height: var(--bar);
  border-radius: 999px 999px 10px 10px;
  background: linear-gradient(180deg, #ff8650, rgba(255, 250, 241, 0.18));
}

.hero-mini-card {
  position: absolute;
  display: grid;
  gap: 4px;
  min-width: 96px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 250, 241, 0.18);
  border-radius: 18px;
  color: #fffaf1;
  background: rgba(16, 18, 23, 0.42);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
}

.hero-mini-card small {
  color: rgba(255, 250, 241, 0.62);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-mini-card strong {
  font-size: 1.28rem;
  line-height: 1;
}

.hero-mini-card-a {
  top: 4px;
  right: 18px;
}

.hero-mini-card-b {
  top: 60px;
  left: 0;
}

.hero-route-line {
  position: absolute;
  top: 52px;
  left: 48px;
  width: 154px;
  height: 46px;
  border-top: 2px solid rgba(255, 134, 80, 0.62);
  border-right: 2px solid rgba(255, 134, 80, 0.40);
  border-radius: 0 36px 0 0;
}

.status-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 210px;
  padding: 24px;
  border-radius: 30px;
  color: #fffaf1;
  background: linear-gradient(150deg, var(--ink), var(--blue));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.status-card span,
.status-card small {
  color: rgba(255, 250, 241, 0.64);
}

.status-card strong {
  margin: 8px 0;
  font-size: 1.9rem;
  line-height: 1;
}

.warning-banner {
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(166, 56, 32, 0.22);
  border-radius: 18px;
  color: #7b2b1c;
  background: rgba(255, 106, 42, 0.12);
  font-weight: 800;
}

.filter-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 250, 241, 0.78);
  box-shadow: 0 18px 60px rgba(31, 24, 15, 0.10);
  backdrop-filter: blur(16px);
}

.widget-aggregator {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
  align-items: center;
  margin: -4px 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgba(112, 118, 132, 0.13), transparent 18rem),
    rgba(255, 250, 241, 0.78);
  box-shadow: 0 18px 60px rgba(31, 24, 15, 0.09);
  backdrop-filter: blur(16px);
}

.widget-aggregator-copy h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  letter-spacing: -0.055em;
}

.widget-aggregator-copy p,
.widget-aggregator-meta,
.widget-empty-dashboard {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 780;
  line-height: 1.45;
}

.widget-aggregator-copy p {
  max-width: 560px;
  margin: 6px 0 0;
}

.widget-aggregator-controls {
  display: grid;
  gap: 8px;
}

.widget-aggregator-controls label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.widget-aggregator-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.widget-aggregator-actions select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid rgba(16, 18, 23, 0.13);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  font-weight: 850;
}

.widget-native-select {
  display: none;
}

.widget-custom-select {
  position: relative;
  z-index: 40;
  min-width: 0;
}

.widget-custom-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 10px 44px 10px 16px;
  border: 1px solid rgba(16, 18, 23, 0.12);
  border-radius: 18px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.98), rgba(255, 255, 255, 0.88)),
    rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 10px 28px rgba(31, 24, 15, 0.08);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-align: left;
}

.widget-custom-select-button::after {
  content: "";
  position: absolute;
  right: 18px;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: 0.62;
  transition: transform 160ms ease, opacity 160ms ease;
}

.widget-custom-select.is-open .widget-custom-select-button::after {
  transform: translateY(3px) rotate(225deg);
  opacity: 0.92;
}

.widget-custom-select-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.widget-custom-select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 280px;
  padding: 8px;
  overflow: auto;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 20px;
  background:
    radial-gradient(circle at 12% 0%, rgba(112, 118, 132, 0.10), transparent 12rem),
    rgba(255, 250, 241, 0.99);
  box-shadow: 0 24px 60px rgba(31, 24, 15, 0.18);
  backdrop-filter: blur(18px);
}

.widget-custom-select-option {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  text-align: left;
}

.widget-custom-select-option:hover,
.widget-custom-select-option:focus-visible {
  outline: none;
  color: var(--ink);
  background: rgba(112, 118, 132, 0.16);
  box-shadow: inset 0 0 0 1px rgba(112, 118, 132, 0.16);
}

.widget-custom-select-option[aria-selected="true"] {
  outline: none;
  color: var(--ink);
  background: rgba(112, 118, 132, 0.12);
  box-shadow: inset 3px 0 0 rgba(112, 118, 132, 0.72);
}

.widget-custom-select-empty {
  color: var(--muted);
  cursor: default;
  font-weight: 780;
}

.widget-custom-select-empty {
  padding: 10px 12px;
}

.widget-aggregator-actions select:focus-visible,
.widget-custom-select-button:focus-visible,
.widget-aggregator-actions button:focus-visible {
  outline: 3px solid rgba(112, 118, 132, 0.24);
  outline-offset: 3px;
}

.widget-add-button,
.widget-reset-button {
  min-height: 42px;
  cursor: pointer;
}

.widget-add-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.widget-aggregator-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.widget-aggregator-meta span:first-child {
  color: var(--ink);
}

.widget-empty-dashboard {
  margin: 4px 0 0;
  padding: 12px 14px;
  border: 1px dashed rgba(255, 106, 42, 0.36);
  border-radius: 16px;
  color: #7b2b1c;
  background: rgba(255, 106, 42, 0.10);
}

.widget-control-group {
  position: relative;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 20px;
  margin-left: auto;
}

.widget-maximize-button,
.widget-close-button {
  --widget-close-visual-size: 32px;
  --widget-close-hit-size: 44px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--widget-close-visual-size);
  height: var(--widget-close-visual-size);
  margin: 0;
  border: 1px solid var(--widget-close-border);
  border-radius: 999px;
  color: var(--widget-close-icon);
  background: var(--widget-close-surface);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  touch-action: manipulation;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.widget-maximize-button::before,
.widget-close-button::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--widget-close-hit-size);
  height: var(--widget-close-hit-size);
  border-radius: 999px;
  content: "";
  transform: translate(-50%, -50%);
}

.widget-maximize-button:hover:not(:disabled) {
  border-color: #11181c;
  color: #fffaf1;
  background: #11181c;
  box-shadow: 0 10px 22px rgba(32, 63, 136, 0.22);
  transform: translateY(-1px);
}

.widget-close-button:hover:not(:disabled) {
  border-color: var(--widget-close-surface);
  color: #fffaf1;
  background: var(--accent-dark);
  box-shadow: 0 10px 22px rgba(200, 74, 19, 0.22);
  transform: translateY(-1px);
}

.widget-maximize-button:active:not(:disabled) {
  background: #172c63;
  box-shadow: 0 4px 12px rgba(32, 63, 136, 0.18);
  transform: translateY(0);
}

.widget-close-button:active:not(:disabled) {
  background: #8f3117;
  box-shadow: 0 4px 12px rgba(200, 74, 19, 0.18);
  transform: translateY(0);
}

.widget-maximize-button:focus-visible,
.widget-close-button:focus-visible {
  outline: 3px solid var(--widget-close-focus-dark);
  outline-offset: 2px;
  box-shadow: 0 0 0 7px var(--widget-close-focus-light);
}

.widget-maximize-button:disabled,
.widget-close-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.widget-maximize-button .ui-icon {
  width: 14px;
  height: 14px;
}

.kpi-card > .widget-control-group {
  position: absolute;
  top: 8px;
  right: 8px;
}

.kpi-card.has-widget-controls {
  padding-right: 118px;
}

.kpi-card.is-widget-maximized {
  padding-right: max(118px, calc(env(safe-area-inset-right) + 100px)) !important;
}

.kpi-card.is-widget-maximized > .widget-control-group {
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
}

body.widget-maximized {
  position: fixed;
  top: var(--widget-scroll-lock-top, 0);
  right: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  padding-right: var(--widget-scrollbar-gap, 0);
}

.is-widget-maximized {
  position: fixed !important;
  inset: 0 !important;
  z-index: 70 !important;
  display: flex !important;
  flex-direction: column;
  width: 100vw !important;
  max-width: none !important;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left)) !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  border-radius: 0 !important;
  background: var(--panel-solid) !important;
  box-shadow: none !important;
  isolation: isolate;
}

.is-widget-maximized > .card-heading,
.is-widget-maximized > [data-widget-heading] {
  position: sticky;
  top: 0;
  z-index: 5;
  flex: 0 0 auto;
  padding: 4px 0 14px;
  background: linear-gradient(180deg, var(--panel-solid) 0%, var(--panel-solid) 86%, rgba(255, 250, 241, 0) 100%);
}

.is-widget-maximized.table-card,
.is-widget-maximized.production-coverage-card,
.production-panel.is-widget-maximized {
  overflow: hidden !important;
}

.is-widget-maximized .ranking-table-wrap,
.production-coverage-card.is-widget-maximized .production-coverage-list,
.production-panel.is-widget-maximized .production-machine-groups,
.production-panel.is-widget-maximized .production-timeline-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}

.production-coverage-card.is-widget-maximized .production-coverage-list {
  max-height: none;
}

.delivery-zone-map-card.is-widget-maximized {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

.delivery-zone-map-card.is-widget-maximized .delivery-zone-map-layout {
  display: grid;
  flex: 1 0 auto;
  grid-template-rows: minmax(clamp(220px, 50dvh, 360px), 1fr) auto;
  min-height: min-content;
  overflow: visible;
}

.delivery-zone-map-card.is-widget-maximized .delivery-zone-map {
  height: 100%;
  min-height: 0;
}

.delivery-zone-map-card.is-widget-maximized .delivery-zone-map-summary {
  order: 0;
}

.delivery-cycle-card.is-widget-maximized .delivery-cycle-heatmap {
  display: grid;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}

.chart-card.is-widget-maximized > canvas {
  flex: 1 1 auto;
  min-height: 320px;
  height: auto !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.tab-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 7px;
  grid-column: 1 / -1;
  padding: 6px;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.50);
}

.tab-strip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 0.94rem;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.tab-strip button.is-active {
  color: #fffaf1;
  background: linear-gradient(135deg, var(--ink), var(--green));
  box-shadow: 0 14px 30px rgba(16, 18, 23, 0.18);
}

.filter-drawer {
  min-width: 0;
}

.filter-drawer > summary {
  list-style: none;
}

.filter-drawer > summary::-webkit-details-marker {
  display: none;
}

.filter-summary {
  display: grid;
  grid-template-columns: minmax(170px, 0.28fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 20px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.42);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.filter-panel.has-pending .filter-summary {
  border-color: rgba(255, 106, 42, 0.42);
  background: rgba(255, 250, 241, 0.70);
  box-shadow: 0 0 0 4px rgba(255, 106, 42, 0.08);
}

.filter-summary-heading .eyebrow {
  margin-bottom: 2px;
}

.filter-summary-heading strong {
  display: block;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.filter-pending-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 22px;
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #7b2b1c;
  background: rgba(255, 106, 42, 0.14);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.filter-pending-pill[hidden] {
  display: none;
}

.filter-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.filter-summary-chips span {
  display: inline-flex;
  align-items: center;
  max-width: min(290px, 100%);
  min-height: 30px;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 250, 241, 0.70);
  font-size: 0.74rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-summary-chips strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.filter-toggle-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #fffaf1;
  background: linear-gradient(135deg, var(--ink), var(--green));
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.filter-toggle-text::after {
  content: "↑";
  font-size: 0.82rem;
  line-height: 1;
}

.filter-drawer:not([open]) .filter-toggle-text::after {
  content: "↓";
}

.filter-body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.filter-group {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.46);
}

.filter-years {
  grid-column: span 3;
}

.filter-months {
  grid-column: span 4;
}

.filter-channel {
  grid-column: span 5;
}

.filter-product,
.filter-article-group,
.top-filter-group {
  grid-column: span 4;
}

.filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-bottom: 9px;
}

.filter-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.filter-tools {
  display: flex;
  gap: 5px;
}

.filter-tools button {
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.38);
  font-size: 0.64rem;
  font-weight: 900;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.filter-tools button:hover {
  color: var(--ink);
  border-color: rgba(16, 18, 23, 0.18);
  background: rgba(255, 255, 255, 0.76);
  transform: translateY(-1px);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 108px;
  overflow: auto;
  padding-right: 4px;
}

.compact-list {
  max-height: none;
}

.article-chip-list {
  max-height: 160px;
}

.compact-search-list {
  max-height: 96px;
  min-height: 0;
}

.compact-search-list:empty {
  display: none;
}

.compact-search-hint {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

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

.purchase-lookup-filter {
  grid-column: span 6;
}

.top-filter-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.filter-select,
.chip-search {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
}

.filter-select {
  padding: 7px 12px;
}

.chip-search {
  margin-bottom: 8px;
  padding: 8px 12px;
}

.filter-select:focus,
.chip-search:focus {
  border-color: rgba(255, 106, 42, 0.65);
  box-shadow: 0 0 0 4px rgba(255, 106, 42, 0.12);
}

.filter-chip {
  cursor: pointer;
  min-width: 0;
  position: relative;
}

.filter-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.filter-chip input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(255, 106, 42, 0.20);
}

.filter-chip span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 999px;
  color: rgba(16, 18, 23, 0.72);
  background: rgba(255, 255, 255, 0.40);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
}

.filter-chip:hover span {
  color: var(--ink);
  border-color: rgba(16, 18, 23, 0.16);
  background: rgba(255, 255, 255, 0.72);
}

.filter-chip.is-active span {
  color: #fffaf1;
  border-color: rgba(16, 18, 23, 0.10);
  background: linear-gradient(135deg, var(--ink), var(--green));
  box-shadow: 0 8px 18px rgba(24, 63, 53, 0.16);
  font-weight: 900;
}

.filter-chip.is-active:hover span {
  background: linear-gradient(135deg, #0b1513, var(--green));
  box-shadow: 0 10px 22px rgba(24, 63, 53, 0.22);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
}

.filter-actions .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.filter-actions .primary-button:disabled,
.tab-strip button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none;
}

.filter-panel.is-submitting .filter-actions .primary-button:disabled,
.filter-panel.is-submitting .tab-strip button:disabled {
  cursor: wait;
}

.button-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 250, 241, 0.35);
  border-top-color: #fffaf1;
  border-radius: 999px;
  animation: loading-spin 850ms linear infinite;
}

.button-spinner[hidden] {
  display: none;
}

.selection-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: -8px 0 24px;
}

.selection-bar-wide {
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.selection-bar div {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 250, 241, 0.76);
  box-shadow: 0 12px 40px rgba(31, 24, 15, 0.08);
}

.selection-bar span,
.selection-bar strong {
  display: block;
}

.selection-bar span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.selection-bar strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slim-button {
  width: auto;
  padding: 11px 20px;
}

.reset-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  text-decoration: none;
}

.reset-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}

.reset-button:disabled:hover {
  box-shadow: none;
  transform: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(245, 240, 232, 0.58);
  backdrop-filter: blur(8px);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(360px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 28px;
  color: var(--ink);
  background: rgba(255, 250, 241, 0.94);
  box-shadow: 0 28px 90px rgba(31, 24, 15, 0.20);
  text-align: center;
}

.loading-card strong {
  font-size: 1rem;
  font-weight: 900;
}

.loading-card small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.45;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(32, 63, 136, 0.18);
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: loading-spin 850ms linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card,
.chart-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(31, 24, 15, 0.11);
  backdrop-filter: blur(16px);
}

.kpi-card {
  position: relative;
  min-height: 160px;
  padding: 22px;
  border-radius: 28px;
}

.kpi-card span,
.kpi-card small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.kpi-card > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.kpi-card strong {
  display: block;
  margin: 16px 0 10px;
  font-size: clamp(1.42rem, 2.35vw, 2.55rem);
  line-height: 1;
  letter-spacing: -0.07em;
  white-space: nowrap;
}

.sales-preparation-kpis {
  margin-bottom: 24px;
}

/* Read-only sales preparation monitor */
.sales-monitor-shell {
  --sales-monitor-muted: var(--muted);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.sales-monitor-panel,
.sales-monitor-empty {
  border: 1px solid var(--line);
  background: var(--panel);
}

.sales-monitor-hero-status {
  align-self: center;
  justify-self: end;
}

.sales-monitor-readonly {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(24, 121, 84, 0.36);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(24, 121, 84, 0.22);
  font-size: 0.76rem;
  font-weight: 900;
}

.sales-monitor-readonly > span {
  color: #5fd19d;
}

.sales-monitor-readonly.is-unavailable {
  border-color: rgba(166, 56, 32, 0.52);
  background: rgba(166, 56, 32, 0.28);
}

.sales-monitor-readonly.is-unavailable > span {
  color: #ff9b88;
}

.sales-monitor-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sales-monitor-kpi {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}

.sales-monitor-kpi > span,
.sales-monitor-kpi small {
  display: block;
  overflow: hidden;
  color: var(--sales-monitor-muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-monitor-kpi > strong {
  display: block;
  margin: 5px 0 4px;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.sales-monitor-kpi > strong em {
  color: var(--sales-monitor-muted);
  font-size: 0.55em;
  font-style: normal;
}

.sales-monitor-kpi .sales-coverage-progress {
  height: 6px;
  margin: 4px 0 6px;
}

.sales-monitor-workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.82fr) minmax(0, 1.55fr);
  gap: 12px;
  min-height: 0;
}

.sales-monitor-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 24px;
}

.sales-monitor-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.sales-monitor-panel h2,
.sales-monitor-panel h3 {
  margin: 0;
  letter-spacing: -0.035em;
}

.sales-monitor-panel h2 {
  font-size: 1.05rem;
}

.sales-monitor-panel > header > span,
.sales-detail-section-heading > span {
  color: var(--sales-monitor-muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.sales-monitor-customers {
  grid-template-rows: auto minmax(0, 1fr);
}

.sales-monitor-customer-list {
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  outline: none;
  scrollbar-color: rgba(28, 78, 69, 0.32) transparent;
}

.sales-monitor-customer-list:focus-visible {
  box-shadow: inset 0 0 0 3px rgba(255, 106, 42, 0.32);
}

.sales-customer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 0.7fr) minmax(105px, auto);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  margin: 0 0 6px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.47);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.sales-customer-row:hover,
.sales-customer-row.is-selected {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  background: color-mix(in srgb, var(--panel) 86%, var(--accent));
}

.sales-customer-row:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.sales-customer-row.is-selected {
  box-shadow: inset 4px 0 0 var(--accent);
}

.sales-customer-name,
.sales-customer-metrics {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.sales-customer-name strong,
.sales-customer-name small,
.sales-customer-metrics small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-customer-name strong {
  font-size: 0.78rem;
}

.sales-customer-name small,
.sales-customer-metrics small {
  color: var(--sales-monitor-muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.sales-customer-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 18, 23, 0.1);
}

.sales-customer-progress i {
  display: block;
  width: var(--customer-coverage);
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.sales-customer-row.status-covered .sales-customer-progress i { background: #187954; }
.sales-customer-row.status-uncovered .sales-customer-progress i,
.sales-customer-row.status-invalid .sales-customer-progress i { background: #a63820; }

.sales-customer-metrics {
  text-align: right;
}

.sales-customer-metrics b {
  font-size: 0.88rem;
}

.sales-monitor-details {
  grid-template-rows: auto minmax(0, 1fr);
}

.sales-monitor-status-pill,
.sales-order-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  color: #b8730e;
  background: rgba(184, 115, 14, 0.14);
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}

.sales-monitor-status-pill.status-covered,
.sales-order-status.status-covered {
  color: #187954;
  background: rgba(24, 121, 84, 0.13);
}

.sales-monitor-status-pill.status-uncovered,
.sales-monitor-status-pill.status-invalid,
.sales-order-status.status-uncovered,
.sales-order-status.status-invalid {
  color: #a63820;
  background: rgba(166, 56, 32, 0.13);
}

.sales-monitor-detail-body {
  display: grid;
  grid-template-rows: minmax(120px, 0.72fr) minmax(150px, 1fr);
  gap: 8px;
  min-height: 0;
  padding: 8px;
}

.sales-critical-section,
.sales-orders-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.4);
}

.sales-detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}

.sales-detail-section-heading h3 {
  font-size: 0.88rem;
}

.sales-critical-list,
.sales-orders-table-wrap {
  min-height: 0;
  overflow: auto;
}

.sales-critical-list {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 6px;
}

.sales-critical-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 9px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 86%, #ffffff);
}

.sales-critical-identity,
.sales-critical-metrics {
  display: grid;
  gap: 1px;
}

.sales-critical-identity strong,
.sales-critical-metrics strong {
  font-size: 0.72rem;
}

.sales-critical-identity small,
.sales-critical-metrics small,
.sales-monitor-inline-empty {
  color: var(--sales-monitor-muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.sales-critical-metrics {
  flex: 0 0 auto;
  text-align: right;
}

.sales-monitor-inline-empty {
  padding: 16px;
  text-align: center;
}

.sales-orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.67rem;
}

.sales-orders-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--sales-monitor-muted);
  background: var(--panel);
  font-size: 0.61rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.sales-orders-table th,
.sales-orders-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(16, 18, 23, 0.06);
  white-space: nowrap;
}

.sales-monitor-empty {
  display: grid;
  place-content: center;
  min-height: 320px;
  border-radius: 24px;
  color: var(--sales-monitor-muted);
  text-align: center;
}

.sales-monitor-empty strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.sales-monitor-error {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  align-self: start;
  padding: 18px;
  border: 1px solid rgba(166, 56, 32, 0.42);
  border-radius: 22px;
  color: #a63820;
  background: color-mix(in srgb, var(--panel) 88%, #f7c7bd);
}

.sales-monitor-error > .ui-icon {
  width: 28px;
  height: 28px;
  color: #a63820;
}

.sales-monitor-error strong,
.sales-monitor-error p,
.sales-monitor-error span {
  display: block;
}

.sales-monitor-error p {
  margin: 3px 0;
  font-size: 0.84rem;
  font-weight: 800;
}

.sales-monitor-error div > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.sales-monitor-error .ghost-button {
  min-height: 44px;
  color: #a63820;
  border-color: rgba(166, 56, 32, 0.42);
  background: var(--panel);
}

@media (min-width: 1200px) and (min-height: 820px) {
  body.dashboard-theme:has(.sales-monitor-shell) {
    overflow: hidden;
  }

  .dashboard-theme .app-shell:has(.sales-monitor-shell) {
    height: 100dvh;
    padding-top: 26px;
    padding-bottom: 26px;
    overflow: hidden;
  }

  .dashboard-theme .content-wrap:has(.sales-monitor-shell) {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 52px);
    min-height: 0;
    overflow: hidden;
  }

  .dashboard-theme .content-wrap:has(.sales-monitor-shell) > .dashboard-hero,
  .dashboard-theme .content-wrap:has(.sales-monitor-shell) > .filter-panel {
    flex: 0 0 auto;
  }

  .dashboard-theme .content-wrap:has(.sales-monitor-shell) > .filter-panel {
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .dashboard-theme .content-wrap:has(.sales-monitor-shell) .sales-monitor-shell {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  .dashboard-theme .content-wrap:has(.sales-monitor-shell) .sales-monitor-workspace,
  .dashboard-theme .content-wrap:has(.sales-monitor-shell) .sales-monitor-empty {
    min-height: 0;
  }
}

@media (max-width: 980px), (max-height: 819px) {
  .sales-monitor-shell {
    display: block;
  }

  .sales-monitor-kpis,
  .sales-monitor-workspace {
    margin-bottom: 12px;
  }

  .sales-monitor-workspace {
    grid-template-columns: 1fr;
  }

  .sales-monitor-customer-list,
  .sales-critical-list,
  .sales-orders-table-wrap {
    max-height: 360px;
  }
}

@media (max-width: 700px) {
  .sales-monitor-error {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .sales-monitor-error .ghost-button {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .sales-monitor-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-customer-row {
    grid-template-columns: minmax(0, 1fr) 100px;
  }

  .sales-customer-progress {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 440px) {
  .sales-monitor-kpis {
    grid-template-columns: 1fr;
  }
}

.sales-preparation-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.sales-preparation-heading h2 {
  margin: 5px 0 0;
  font-size: clamp(1.3rem, 2vw, 1.75rem);
  letter-spacing: -0.035em;
}

.sales-preparation-heading p {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.45;
  text-align: right;
}

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

.sales-preparation-card {
  min-width: 0;
  min-height: 174px;
}

.sales-preparation-card strong em {
  color: var(--muted);
  font-size: 0.52em;
  font-style: normal;
  letter-spacing: -0.035em;
}

.sales-coverage-progress {
  height: 9px;
  overflow: hidden;
  margin: 0 0 10px;
  border-radius: 999px;
  background: rgba(16, 18, 23, 0.10);
}

.sales-coverage-progress span {
  display: block;
  width: var(--coverage-fill);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.sales-preparable-card {
  background: linear-gradient(145deg, rgba(30, 90, 74, 0.09), var(--panel));
}

@media (max-width: 980px) {
  .sales-preparation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .sales-preparation-heading {
    display: block;
  }

  .sales-preparation-heading p {
    margin-top: 8px;
    text-align: left;
  }

  .sales-preparation-grid {
    grid-template-columns: 1fr;
  }
}

/* Sales traceability: an operational document trail, intentionally denser than analytics cards. */
.dashboard-theme .sales-traceability-card {
  border: 1px solid #d9e1dc;
  border-radius: 18px;
  background: linear-gradient(145deg, #fbfcf9, #f1f5f0);
  box-shadow: 0 18px 42px rgb(31 55 43 / 8%);
  padding: clamp(18px, 2.5vw, 30px);
}

.dashboard-theme .sales-traceability-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dashboard-theme .sales-traceability-heading h2 { margin: 4px 0; }
.dashboard-theme .sales-traceability-heading p { margin: 0; color: #5c6d64; }
.dashboard-theme .sales-traceability-legend { display: flex; align-items: center; gap: 8px; color: #52645a; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.dashboard-theme .sales-traceability-legend i { width: 18px; height: 1px; background: #a7b8ae; position: relative; }
.dashboard-theme .sales-traceability-legend i::after { content: ""; position: absolute; right: 0; top: -3px; border: 3px solid transparent; border-left-color: #a7b8ae; }

.dashboard-theme .sales-traceability-search { display: grid; grid-template-columns: repeat(6, minmax(105px, 1fr)); gap: 12px; align-items: end; margin: 24px 0; padding: 16px; border-radius: 14px; background: #fff; border: 1px solid #e2e9e4; }
.dashboard-theme .sales-traceability-search label { display: grid; gap: 6px; color: #46584e; font-size: .76rem; font-weight: 800; letter-spacing: .02em; }
.dashboard-theme .sales-traceability-search label[hidden] { display: none; }
.dashboard-theme .sales-traceability-search input,
.dashboard-theme .sales-traceability-search select { min-height: 42px; border: 1px solid #cbd7d0; border-radius: 9px; background: #fbfcfb; padding: 0 11px; color: #24372d; font: inherit; }
.dashboard-theme .sales-traceability-search input:focus,
.dashboard-theme .sales-traceability-search select:focus { outline: 3px solid rgb(42 128 86 / 18%); border-color: #2a8056; }
.dashboard-theme .sales-traceability-search button { min-height: 42px; border: 0; border-radius: 9px; padding: 0 16px; background: #206e49; color: #fff; font-weight: 800; cursor: pointer; }
.dashboard-theme .sales-traceability-search button:hover { background: #185a3b; }

.dashboard-theme .sales-traceability-state { display: grid; gap: 5px; place-items: center; min-height: 150px; padding: 24px; border: 1px dashed #bdcbc2; border-radius: 14px; color: #65766c; text-align: center; }
.dashboard-theme .sales-traceability-state strong { color: #30473a; font-size: 1rem; }
.dashboard-theme .sales-traceability-state[data-tone="error"] { border-color: #dba8a4; background: #fff6f5; }
.dashboard-theme .sales-traceability-state[data-tone="loading"] { background: linear-gradient(90deg, #f5f8f5, #fff, #f5f8f5); background-size: 200% 100%; animation: trace-loading 1.4s linear infinite; }
@keyframes trace-loading { to { background-position: -200% 0; } }

.dashboard-theme .sales-traceability-flow { position: relative; display: grid; grid-template-columns: repeat(4, minmax(210px, 1fr)); gap: 18px; align-items: start; overflow-x: auto; padding: 8px 4px 14px; }
.dashboard-theme .sales-traceability-flow[hidden] { display: none; }
.dashboard-theme .sales-traceability-result-heading { grid-column: 1 / -1; margin: 0 0 2px; color: #2c4437; font-size: 1rem; }
.dashboard-theme .sales-traceability-result-heading:focus { outline: 3px solid rgb(42 128 86 / 18%); outline-offset: 4px; border-radius: 4px; }
.dashboard-theme .sales-traceability-truncation { grid-column: 1 / -1; margin: 0; border: 1px solid #e1bd69; border-radius: 10px; background: #fff7de; padding: 10px 12px; color: #70551a; font-size: .75rem; font-weight: 750; }
.dashboard-theme .sales-traceability-stage { position: relative; display: grid; align-content: start; gap: 10px; min-width: 0; }
.dashboard-theme .sales-traceability-stage h3 { margin: 0 0 2px; color: #496057; font-size: .75rem; letter-spacing: .11em; text-transform: uppercase; }
.dashboard-theme .sales-traceability-connector { position: absolute; top: 58px; right: -17px; z-index: 2; display: grid; place-items: center; width: 18px; height: 18px; color: #7b9486; font-weight: 900; }
.dashboard-theme .sales-traceability-document { border: 1px solid #dce5df; border-left: 4px solid #739484; border-radius: 12px; background: #fff; padding: 13px; box-shadow: 0 7px 18px rgb(39 68 53 / 7%); }
.dashboard-theme .sales-traceability-document.is-anchor { outline: 3px solid rgb(32 110 73 / 17%); border-color: #2a8056; }
.dashboard-theme .sales-traceability-document.is-danger { border-left-color: #b64b43; }
.dashboard-theme .sales-traceability-document.is-warning { border-left-color: #c38b27; }
.dashboard-theme .sales-traceability-document header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.dashboard-theme .sales-traceability-document header strong { color: #263b30; font-size: .86rem; }
.dashboard-theme .sales-traceability-document header span { border-radius: 999px; background: #edf4ef; padding: 3px 7px; color: #426050; font-size: .65rem; font-weight: 800; }
.dashboard-theme .sales-traceability-document p { margin: 8px 0; color: #687970; font-size: .72rem; }
.dashboard-theme .sales-traceability-observation { display: block; margin: 8px 0; color: #5c6b63; font-size: .7rem; }
.dashboard-theme .sales-traceability-relation-label { display: block; margin-top: 9px; color: #64756b; font-size: .63rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.dashboard-theme .sales-traceability-origin-details { margin: 7px 0 6px; }
.dashboard-theme .sales-traceability-origin-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; border: 1px solid #dce8e0; border-radius: 8px; background: #f7faf8; padding: 5px 8px; color: #486257; font-size: .65rem; font-weight: 850; letter-spacing: .035em; text-transform: uppercase; list-style: none; }
.dashboard-theme .sales-traceability-origin-details > summary::-webkit-details-marker { display: none; }
.dashboard-theme .sales-traceability-origin-details > summary::after { content: '+'; display: grid; place-items: center; width: 18px; height: 18px; margin-left: auto; border-radius: 999px; background: #e8f1eb; color: #28734e; font-size: .85rem; line-height: 1; }
.dashboard-theme .sales-traceability-origin-details[open] > summary::after { content: '−'; }
.dashboard-theme .sales-traceability-origin-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 999px; background: #e8f1eb; padding: 0 6px; color: #355444; font-size: .62rem; font-weight: 850; letter-spacing: 0; }
.dashboard-theme .sales-traceability-origin-details .sales-traceability-relations { max-height: 230px; overflow-y: auto; overscroll-behavior: contain; margin: 5px 0 2px; padding-right: 2px; scrollbar-gutter: stable; }
.dashboard-theme .sales-traceability-relations { display: grid; gap: 5px; margin: 6px 0 9px; padding: 0; list-style: none; }
.dashboard-theme .sales-traceability-relations li { display: grid; gap: 2px; border: 1px solid #dce8e0; border-radius: 8px; background: #f5faf7; padding: 7px; }
.dashboard-theme .sales-traceability-relations li.is-erp-reference { border-color: #e7cf8c; background: #fff8e5; }
.dashboard-theme .sales-traceability-relations strong { color: #355444; font-size: .66rem; }
.dashboard-theme .sales-traceability-relations small { color: #687970; font-size: .61rem; }
.dashboard-theme .sales-traceability-document summary { cursor: pointer; color: #28734e; font-size: .73rem; font-weight: 800; }
.dashboard-theme .sales-traceability-lines { display: grid; gap: 7px; margin-top: 9px; }
.dashboard-theme .sales-traceability-lines > div { display: grid; gap: 2px; padding-top: 7px; border-top: 1px solid #edf1ee; }
.dashboard-theme .sales-traceability-lines span { color: #34483d; font-size: .7rem; }
.dashboard-theme .sales-traceability-lines small { color: #67776e; font-size: .66rem; }
.dashboard-theme .sales-traceability-stage-empty { min-height: 72px; display: grid; place-items: center; margin: 0; border: 1px dashed #cbd6cf; border-radius: 11px; color: #7a8981; font-size: .74rem; text-align: center; }
.dashboard-theme .sales-traceability-reference { grid-column: 3 / 5; margin: 2px 0 0; border-radius: 9px; background: #fff4d8; border: 1px solid #e7cf8c; padding: 9px 12px; color: #6b5519; font-size: .72rem; font-weight: 800; }
.dashboard-theme .sales-traceability-group { grid-column: 1 / -1; display: grid; gap: 8px; border: 1px solid #d8e2dc; border-radius: 12px; background: #fff; padding: 12px; }
.dashboard-theme .sales-traceability-group h3 { margin: 0; color: #324a3d; font-size: .82rem; }
.dashboard-theme .sales-traceability-group-transaction { display: block; margin-top: -3px; color: #718078; font-size: .66rem; font-weight: 750; }
.dashboard-theme .sales-traceability-group .sales-traceability-reference { grid-column: auto; }
.dashboard-theme .sales-traceability-group-members { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.dashboard-theme .sales-traceability-group-members li { border-left: 3px solid #8aa798; border-radius: 6px; background: #f5f8f6; padding: 7px 9px; color: #53665c; font-size: .67rem; }

/* Contextual sales traceability viewer. It lives in the browser top layer so
   opening it never replaces the current list, drill-down or maximized widget. */
.dashboard-theme .sales-traceability-modal {
  width: min(1460px, calc(100vw - 34px));
  max-width: none;
  height: min(88vh, 920px);
  max-height: 88vh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  background: #f7f7f3;
  color: #24372d;
  box-shadow: 0 28px 90px rgb(8 18 14 / 38%);
}

.dashboard-theme .sales-traceability-modal::backdrop {
  background: rgb(10 18 15 / 66%);
  backdrop-filter: blur(2px);
}

.dashboard-theme .sales-traceability-modal-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
}

.dashboard-theme .sales-traceability-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid #d9e1dc;
  background: linear-gradient(135deg, #17211e, #111917);
  color: #fffaf1;
}

.dashboard-theme .sales-traceability-modal-heading-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-theme .sales-traceability-modal-heading-copy .eyebrow {
  color: #f3a33a;
}

.dashboard-theme .sales-traceability-modal-heading-copy h2 {
  margin: 0;
  overflow: hidden;
  color: #fffaf1;
  font-size: 1.15rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-modal-heading-copy p {
  margin: 0;
  color: rgb(255 250 241 / 66%);
  font-size: .7rem;
  line-height: 1.35;
}

.dashboard-theme .sales-traceability-modal-close {
  flex: 0 0 auto;
  border-color: rgb(255 255 255 / 42%);
  color: #fff;
  background: transparent;
}

.dashboard-theme .sales-traceability-modal-close:hover,
.dashboard-theme .sales-traceability-modal-close:focus-visible {
  border-color: #fff;
  color: #111917;
  background: #fff;
}

.dashboard-theme .sales-traceability-modal-query {
  position: fixed;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-modal-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px;
  background: linear-gradient(145deg, #fbfcf9, #f1f5f0);
  scrollbar-gutter: stable;
}

.dashboard-theme .sales-traceability-modal-body .sales-traceability-state {
  min-height: 190px;
  background-color: #fff;
}

.dashboard-theme .sales-traceability-modal-body .sales-traceability-flow {
  min-width: 920px;
  overflow: visible;
  padding: 4px 2px 18px;
}

@media (max-width: 900px) {
  .dashboard-theme .sales-traceability-modal {
    width: calc(100vw - 20px);
    height: 92vh;
    max-height: 92vh;
    border-radius: 15px;
  }

  .dashboard-theme .sales-traceability-modal-header {
    padding: 13px 14px 12px;
  }

  .dashboard-theme .sales-traceability-modal-heading-copy p {
    max-width: 72vw;
  }

  .dashboard-theme .sales-traceability-modal-body {
    padding: 14px;
  }
}

@media (max-width: 1100px) {
  .dashboard-theme .sales-traceability-search { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}
@media (max-width: 720px) {
  .dashboard-theme .sales-traceability-heading { display: grid; }
  .dashboard-theme .sales-traceability-legend { display: none; }
  .dashboard-theme .sales-traceability-search { grid-template-columns: 1fr 1fr; }
  .dashboard-theme .sales-traceability-search button { grid-column: 1 / -1; }
  .dashboard-theme .sales-traceability-flow { grid-template-columns: repeat(4, minmax(240px, 78vw)); scroll-snap-type: x proximity; }
  .dashboard-theme .sales-traceability-stage { scroll-snap-align: start; }
}

.kpi-main {
  color: #fffaf1;
  background: linear-gradient(150deg, var(--green), #0d1715);
}

.kpi-main span,
.kpi-main small {
  color: rgba(255, 250, 241, 0.7);
}

.delivery-today-card {
  background:
    linear-gradient(135deg, var(--delivery-soft-tone), rgba(255, 250, 241, 0.88));
  box-shadow: 0 18px 60px rgba(31, 24, 15, 0.11), inset 0 0 0 1px color-mix(in srgb, var(--delivery-tone) 22%, transparent);
}

.delivery-today-values {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 6px;
}

.delivery-today-card strong {
  margin: 0;
  color: var(--delivery-tone);
}

.delivery-percent {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  flex: 0 0 auto;
  margin: 0;
  color: var(--delivery-tone);
  font-size: clamp(1.6rem, 2.35vw, 2.55rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.06em;
}

.delivery-percent em {
  color: color-mix(in srgb, var(--delivery-tone) 72%, #101217);
  font-size: clamp(0.92rem, 1.25vw, 1.18rem);
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.delivery-today-card small {
  display: block;
  line-height: 1.25;
}

.delivery-progress {
  height: 9px;
  overflow: hidden;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(16, 18, 23, 0.10);
}

.delivery-progress span {
  display: block;
  width: max(6px, var(--delivery-fill));
  height: 100%;
  border-radius: inherit;
  background: var(--delivery-tone);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.is-graph-visible .delivery-progress span {
  transform: scaleX(1);
}

.dashboard-grid {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.chart-card {
  min-width: 0;
  padding: 22px;
  border-radius: 30px;
}

.chart-card canvas {
  width: 100% !important;
  height: 300px !important;
}

.wide-card #monthlySalesChart {
  height: 340px !important;
}

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

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

.delivery-cycle-card {
  overflow: hidden;
}

.delivery-zone-map-card {
  overflow: hidden;
}

.delivery-zone-map-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

.delivery-zone-map {
  min-height: 470px;
  overflow: hidden;
  border: 1px solid rgba(24, 63, 53, 0.12);
  border-radius: 22px;
  background: #eef1ef;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.delivery-zone-map-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  order: -1;
}

.delivery-zone-map-summary span {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(24, 63, 53, 0.1);
  border-radius: 16px;
  background: rgba(255, 250, 241, 0.84);
}

.delivery-zone-map-summary strong {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.delivery-zone-map-summary b {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 950;
}

.delivery-zone-popup {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.delivery-zone-popup strong {
  color: #102f28;
  font-weight: 950;
}

.delivery-zone-popup span {
  color: #ff5f2d;
  font-weight: 950;
}

.delivery-zone-popup small {
  color: #667085;
  font-weight: 750;
}

.delivery-zone-legend {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(24, 63, 53, 0.14);
  border-radius: 14px;
  background: rgba(255, 250, 241, 0.92);
  box-shadow: 0 12px 26px rgba(24, 63, 53, 0.13);
}

.delivery-zone-legend strong {
  color: #102f28;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.delivery-zone-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #667085;
  font-size: 0.68rem;
  font-weight: 800;
}

.delivery-zone-legend i {
  width: 14px;
  height: 9px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(16, 47, 40, 0.14);
}

.delivery-cycle-heatmap {
  display: grid;
  gap: 7px;
}

.delivery-cycle-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(118px, 0.7fr)) minmax(98px, 0.45fr);
  align-items: stretch;
  gap: 6px;
}

.delivery-cycle-row > span,
.delivery-cycle-row > strong,
.delivery-cycle-row > b {
  min-width: 0;
  border-radius: 12px;
  padding: 8px 10px;
}

.delivery-cycle-head > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(16, 18, 23, 0.04);
}

.cycle-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.cycle-sort-button::after {
  content: "↕";
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1;
  opacity: .48;
}

.delivery-cycle-head > span[aria-sort="ascending"] .cycle-sort-button::after {
  content: "↑";
  opacity: .92;
}

.delivery-cycle-head > span[aria-sort="descending"] .cycle-sort-button::after {
  content: "↓";
  opacity: .92;
}

.delivery-cycle-row > strong {
  display: grid;
  gap: 2px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 18, 23, 0.06);
}

.delivery-cycle-row > strong span {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 1000;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-cycle-row > strong em {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 900;
}

.delivery-cycle-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3a2206;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  font-weight: 1000;
  background:
    linear-gradient(90deg, rgba(255, 240, 145, 0.72), rgba(255, 138, 66, var(--cycle-intensity))),
    #fff8d8;
  box-shadow: inset 0 0 0 1px rgba(112, 54, 8, 0.06);
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transition:
    opacity 520ms ease,
    transform 680ms cubic-bezier(0.22, 1, 0.36, 1);
}

.is-graph-visible .delivery-cycle-cell {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.delivery-cycle-action {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(16, 18, 23, 0.06);
}

.delivery-cycle-detail-button {
  min-height: 30px;
  padding: 7px 10px;
  white-space: nowrap;
}

.delivery-cycle-modal {
  width: min(1060px, calc(100vw - 44px));
  padding: 18px 20px 20px;
  border-radius: 22px;
}

.delivery-cycle-modal .modal-heading {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.delivery-cycle-modal .modal-heading .eyebrow {
  margin-bottom: 5px;
  font-size: 0.68rem;
}

.delivery-cycle-modal .modal-heading h2 {
  font-size: 1.05rem;
  line-height: 1.15;
}

.delivery-cycle-modal .modal-heading p {
  margin-top: 5px;
  font-size: 0.78rem;
}

.delivery-cycle-modal .modal-close-button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  font-size: 1rem;
}

.delivery-cycle-modal-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.delivery-cycle-modal-summary span {
  min-height: 46px;
  padding: 7px 10px;
  border-radius: 12px;
}

.delivery-cycle-modal-summary strong {
  margin-bottom: 3px;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.delivery-cycle-modal-summary b {
  font-size: 0.82rem;
}

.delivery-cycle-modal .modal-table-wrap {
  max-height: min(54vh, 430px);
  padding-right: 2px;
}

.delivery-cycle-detail-table {
  min-width: 940px;
  border-spacing: 0 4px;
  table-layout: fixed;
}

.delivery-cycle-detail-table th {
  padding: 6px 8px;
  font-size: 0.62rem;
  line-height: 1.15;
}

.delivery-cycle-detail-table td {
  padding: 7px 8px;
  font-size: 0.78rem;
  line-height: 1.16;
}

.delivery-cycle-detail-table th:nth-child(1),
.delivery-cycle-detail-table td:nth-child(1) {
  width: 10%;
}

.delivery-cycle-detail-table th:nth-child(2),
.delivery-cycle-detail-table td:nth-child(2) {
  width: 14%;
}

.delivery-cycle-detail-table th:nth-child(3),
.delivery-cycle-detail-table td:nth-child(3),
.delivery-cycle-detail-table th:nth-child(4),
.delivery-cycle-detail-table td:nth-child(4),
.delivery-cycle-detail-table th:nth-child(5),
.delivery-cycle-detail-table td:nth-child(5) {
  width: 14%;
  white-space: nowrap;
}

.delivery-cycle-detail-table th:nth-child(6),
.delivery-cycle-detail-table td:nth-child(6),
.delivery-cycle-detail-table th:nth-child(7),
.delivery-cycle-detail-table td:nth-child(7),
.delivery-cycle-detail-table th:nth-child(8),
.delivery-cycle-detail-table td:nth-child(8) {
  width: 11%;
  white-space: nowrap;
}

.delivery-cycle-detail-table tr td:first-child {
  border-radius: 11px 0 0 11px;
}

.delivery-cycle-detail-table tr td:last-child {
  border-radius: 0 11px 11px 0;
}

.delivery-cycle-cell.is-total {
  color: #421408;
  background:
    linear-gradient(90deg, rgba(255, 171, 89, 0.58), rgba(164, 0, 45, var(--cycle-intensity))),
    #ffe0c5;
}

.delivery-delay-card {
  overflow: hidden;
}

.delivery-result-card {
  overflow: hidden;
}

.delivery-result-list {
  display: grid;
  gap: 10px;
}

.delivery-result-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(0, 1fr) 72px 58px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.delivery-result-label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.delivery-result-label strong {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 1000;
}

.delivery-result-label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.delivery-result-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 18, 23, 0.08);
}

.delivery-result-track i {
  display: block;
  width: max(7px, var(--result-width));
  height: 100%;
  border-radius: inherit;
  background: var(--result-tone, linear-gradient(90deg, #0e3c34, #31a783));
  box-shadow: 0 8px 22px rgba(26, 106, 85, 0.18);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.is-graph-visible .delivery-result-track i {
  transform: scaleX(1);
}

.delivery-result-row.is-confirmed {
  --result-tone: linear-gradient(90deg, #0e3c34, #31a783);
}

.delivery-result-row.is-not-delivered {
  --result-tone: linear-gradient(90deg, #b7791f, #ffd166);
}

.delivery-result-row.is-returned {
  --result-tone: linear-gradient(90deg, #b42318, #ff8a7a);
}

.delivery-result-row.is-pending {
  --result-tone: linear-gradient(90deg, #64748b, #cbd5e1);
}

.delivery-result-row b {
  color: var(--ink);
  font-size: 0.96rem;
  font-variant-numeric: tabular-nums;
  font-weight: 1000;
  text-align: right;
}

.delivery-result-detail-button {
  min-height: 28px;
  padding: 5px 10px;
  justify-content: center;
  font-size: 0.72rem;
}

.delivery-result-detail-table {
  min-width: 920px;
  border-spacing: 0 4px;
  table-layout: fixed;
}

.delivery-result-detail-table th {
  padding: 6px 8px;
  font-size: 0.62rem;
  line-height: 1.15;
}

.delivery-result-detail-table td {
  padding: 7px 8px;
  font-size: 0.78rem;
  line-height: 1.16;
}

.delivery-result-detail-table th:nth-child(1),
.delivery-result-detail-table td:nth-child(1) {
  width: 8%;
}

.delivery-result-detail-table th:nth-child(2),
.delivery-result-detail-table td:nth-child(2) {
  width: 10%;
  white-space: nowrap;
}

.delivery-result-detail-table th:nth-child(3),
.delivery-result-detail-table td:nth-child(3) {
  width: 32%;
}

.delivery-result-detail-table th:nth-child(4),
.delivery-result-detail-table td:nth-child(4) {
  width: 16%;
  white-space: nowrap;
}

.delivery-result-detail-table th:nth-child(5),
.delivery-result-detail-table td:nth-child(5) {
  width: 19%;
  white-space: nowrap;
}

.delivery-result-detail-table th:nth-child(6),
.delivery-result-detail-table td:nth-child(6) {
  width: 16%;
  white-space: nowrap;
}

.delivery-delay-bars {
  display: grid;
  gap: 12px;
}

.delivery-delay-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 52px 58px 58px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: var(--ink);
  font-weight: 900;
}

.delivery-delay-row span {
  color: #5d6878;
  font-size: 0.86rem;
  font-weight: 900;
  white-space: nowrap;
}

.delivery-delay-track {
  height: 15px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 18, 23, 0.08);
}

.delivery-delay-track i {
  display: block;
  width: max(7px, var(--delay-width));
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0e3c34, #31a783, #ff8a42);
  box-shadow: 0 8px 22px rgba(26, 106, 85, 0.22);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.is-graph-visible .delivery-delay-track i {
  transform: scaleX(1);
}

.delivery-delay-row strong,
.delivery-delay-row em {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.delivery-delay-row strong {
  font-size: 0.96rem;
}

.delivery-delay-row em {
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
}

.delivery-delay-detail-button {
  min-height: 28px;
  padding: 5px 10px;
  justify-content: center;
  font-size: 0.72rem;
}

.delivery-delay-modal {
  width: min(1080px, calc(100vw - 44px));
  padding: 18px 20px 20px;
  border-radius: 22px;
}

.delivery-delay-modal .modal-heading {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.delivery-delay-modal .modal-heading .eyebrow {
  margin-bottom: 5px;
  font-size: 0.68rem;
}

.delivery-delay-modal .modal-heading h2 {
  font-size: 1.05rem;
  line-height: 1.15;
}

.delivery-delay-modal .modal-heading p {
  margin-top: 5px;
  font-size: 0.78rem;
}

.delivery-delay-modal .modal-close-button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  font-size: 1rem;
}

.delivery-delay-modal-summary {
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 6px;
  margin-bottom: 10px;
}

.delivery-delay-modal-summary span {
  min-height: 46px;
  padding: 7px 10px;
  border-radius: 12px;
}

.delivery-delay-modal-summary strong {
  margin-bottom: 3px;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.delivery-delay-modal-summary b {
  font-size: 0.82rem;
}

.delivery-delay-modal .modal-table-wrap {
  max-height: min(56vh, 460px);
  padding-right: 2px;
}

.delivery-delay-detail-table {
  min-width: 980px;
  border-spacing: 0 4px;
  table-layout: fixed;
}

.delivery-delay-detail-table th {
  padding: 6px 8px;
  font-size: 0.62rem;
  line-height: 1.15;
}

.delivery-delay-detail-table td {
  padding: 7px 8px;
  font-size: 0.78rem;
  line-height: 1.16;
}

.delivery-delay-detail-table th:nth-child(1),
.delivery-delay-detail-table td:nth-child(1) {
  width: 7%;
}

.delivery-delay-detail-table th:nth-child(2),
.delivery-delay-detail-table td:nth-child(2) {
  width: 28%;
}

.delivery-delay-detail-table th:nth-child(3),
.delivery-delay-detail-table td:nth-child(3) {
  width: 14%;
}

.delivery-delay-detail-table th:nth-child(4),
.delivery-delay-detail-table td:nth-child(4),
.delivery-delay-detail-table th:nth-child(5),
.delivery-delay-detail-table td:nth-child(5) {
  width: 14%;
  white-space: nowrap;
}

.delivery-delay-detail-table th:nth-child(6),
.delivery-delay-detail-table td:nth-child(6) {
  width: 11%;
  white-space: nowrap;
}

.delivery-delay-detail-table th:nth-child(7),
.delivery-delay-detail-table td:nth-child(7) {
  width: 12%;
  white-space: nowrap;
}

.delivery-delay-detail-table tr td:first-child {
  border-radius: 11px 0 0 11px;
}

.delivery-delay-detail-table tr td:last-child {
  border-radius: 0 11px 11px 0;
}

.delivery-monthly-otif-card {
  overflow: hidden;
}

.monthly-otif-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(66px, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 270px;
  padding: 16px 8px 4px;
  border-bottom: 2px solid rgba(16, 18, 23, 0.18);
}

.monthly-otif-bar {
  display: grid;
  grid-template-rows: 28px 1fr 26px;
  align-items: end;
  gap: 8px;
  min-width: 0;
  height: 240px;
  text-align: center;
}

.monthly-otif-bar strong {
  align-self: start;
  justify-self: center;
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 10px;
  color: #fffaf1;
  background: var(--otif-tone);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--otif-tone) 24%, transparent);
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.monthly-otif-track {
  position: relative;
  align-self: stretch;
  overflow: hidden;
  width: 100%;
  min-height: 150px;
  border-radius: 14px 14px 6px 6px;
  background:
    repeating-linear-gradient(to top, rgba(16, 18, 23, 0.07) 0 1px, transparent 1px 34px),
    rgba(16, 18, 23, 0.04);
}

.monthly-otif-track span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: max(8px, var(--otif-height));
  border-radius: 12px 12px 4px 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--otif-tone) 78%, #fffaf1), var(--otif-tone));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.30), 0 -8px 22px color-mix(in srgb, var(--otif-tone) 18%, transparent);
  transform: scaleY(0);
  transform-origin: bottom center;
  transition: transform 920ms cubic-bezier(0.22, 1, 0.36, 1);
}

.is-graph-visible .monthly-otif-track span {
  transform: scaleY(1);
}

.monthly-otif-bar em {
  align-self: center;
  color: #425063;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 950;
  text-transform: capitalize;
  white-space: nowrap;
}

.module-placeholder-card {
  overflow: hidden;
}

.module-placeholder-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.module-placeholder-grid div {
  min-width: 0;
  min-height: 112px;
  padding: 16px;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
}

.module-placeholder-grid strong,
.module-placeholder-grid span {
  display: block;
}

.module-placeholder-grid strong {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
}

.module-placeholder-grid span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
}

.variation-delta-chart {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 18px;
  background: rgba(255, 250, 241, 0.56);
}

.variation-delta-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.8fr) minmax(120px, 2fr) auto;
  align-items: center;
  gap: 12px;
}

.variation-delta-label {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.variation-delta-label strong {
  color: var(--ink);
  font-weight: 950;
}

.variation-delta-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 18, 23, 0.08);
}

.variation-delta-track span {
  display: block;
  width: var(--delta-width);
  min-width: 8px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #11181c, #2a3338);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.is-graph-visible .variation-delta-track span {
  transform: scaleX(1);
}

.variation-delta-row.is-negative .variation-delta-track span {
  background: linear-gradient(90deg, #d88410, #f59f2f);
}

.variation-delta-value {
  color: #11181c;
  font-size: 0.86rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.variation-delta-row.is-negative .variation-delta-value {
  color: #a63820;
}

.variation-explain-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.variation-reading-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed rgba(16, 18, 23, 0.14);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1.35;
}

.variation-explain-item {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-left: 5px solid #11181c;
  border-radius: 16px;
  background: rgba(255, 250, 241, 0.66);
}

.variation-explain-item.is-negative {
  border-left-color: #d88410;
}

.variation-explain-title,
.variation-explain-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.variation-explain-title strong {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 950;
}

.variation-explain-title span,
.variation-explain-values span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.variation-explain-title span {
  color: #11181c;
  font-weight: 950;
}

.variation-explain-values {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.variation-explain-values span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.variation-explain-values .variation-value-winner {
  border-color: rgba(24, 63, 53, 0.2);
  color: #11181c;
  background: rgba(24, 63, 53, 0.08);
}

.variation-explain-values b {
  color: var(--ink);
  font-weight: 950;
}

.variation-explain-diff {
  color: #11181c !important;
}

.variation-explain-item.is-negative .variation-explain-diff {
  color: #d88410 !important;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}

.card-heading h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.card-note {
  max-width: 560px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
}

.chart-insight {
  max-width: 680px;
  margin: 7px 0 0;
  color: #4f5968;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.45;
}

.article-list {
  display: grid;
  gap: 10px;
}

.article-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
}

.article-row strong,
.article-row span {
  display: block;
}

.article-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.article-row b {
  white-space: nowrap;
}

.ranking-grid {
  align-items: start;
}

.ranking-chart-scroll,
.ranking-table-wrap {
  overflow: auto;
  max-height: 720px;
  padding-right: 4px;
}

.ranking-chart-scroll {
  position: relative;
  min-height: 320px;
}

.ranking-chart-scroll canvas {
  display: block;
}

.returns-card {
  overflow: hidden;
}

.batch-alert-card {
  overflow: visible;
}

.return-bars {
  display: grid;
  gap: 12px;
}

.return-bar-row {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 13px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.return-bar-row:focus-visible {
  outline: 3px solid rgba(255, 106, 42, 0.22);
  outline-offset: 3px;
}

.batch-return-row .return-bar-rank {
  min-height: 38px;
  border-radius: 13px;
  background: linear-gradient(150deg, #11181c, #2a3338);
}

.batch-return-row {
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-radius: 17px;
}

.compact-return-row {
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-radius: 17px;
}

.compact-return-row .return-bar-rank {
  min-height: 38px;
  border-radius: 13px;
}

.batch-return-row .return-bar-title strong {
  color: #11181c;
}

.batch-return-row .return-bar-track {
  height: 12px;
  margin: 7px 0 7px;
  background: rgba(24, 63, 53, 0.10);
}

.compact-return-row .return-bar-track {
  height: 12px;
  margin: 7px 0 7px;
}

.batch-return-row .return-bar-track span {
  background: linear-gradient(90deg, #11181c, #2a3338 72%, #606c71);
  box-shadow: 0 8px 18px rgba(24, 63, 53, 0.18);
}

.batch-return-row .return-bar-meta {
  gap: 8px;
}

.batch-return-row .return-bar-meta span,
.compact-return-row .return-bar-meta span {
  min-height: 26px;
  padding-inline: 9px;
}

.compact-return-row .return-bar-meta {
  gap: 8px;
}

.compact-return-row .return-reasons-button {
  min-height: 26px;
  padding-inline: 9px;
}

.return-bar-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 16px;
  color: #fffaf1;
  background: linear-gradient(150deg, #d88410, #f59f2f);
  font-size: 0.8rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.return-bar-content {
  min-width: 0;
}

.return-bar-topline,
.return-bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.return-bar-title {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 8px;
}

.return-bar-title strong {
  flex: 0 0 auto;
  color: #a63820;
  font-size: 0.88rem;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.return-bar-title span {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.return-bar-metric {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.return-bar-track {
  height: 13px;
  overflow: hidden;
  margin: 10px 0 9px;
  border-radius: 999px;
  background: rgba(166, 56, 32, 0.10);
}

.return-bar-track span {
  display: block;
  width: max(8px, var(--bar-width));
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d88410, #f59f2f 70%, #ffd59b);
  box-shadow: 0 8px 18px rgba(166, 56, 32, 0.18);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.is-graph-visible .return-bar-track span {
  transform: scaleX(1);
}

@media (prefers-reduced-motion: reduce) {
  .widget-maximize-button,
  .widget-close-button {
    transition: none;
  }

  .widget-maximize-button:hover:not(:disabled),
  .widget-maximize-button:active:not(:disabled),
  .widget-close-button:hover:not(:disabled),
  .widget-close-button:active:not(:disabled) {
    transform: none;
  }

  .delivery-progress span,
  .delivery-cycle-cell,
  .delivery-result-track i,
  .delivery-delay-track i,
  .monthly-otif-track span,
  .variation-delta-track span,
  .return-bar-track span {
    transition: none;
  }
}

.return-reasons-details {
  display: inline-flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
}

.return-reasons-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid rgba(166, 56, 32, 0.16);
  border-radius: 999px;
  color: #7b2b1c;
  background: rgba(255, 106, 42, 0.10);
  font-size: 0.76rem;
  font-weight: 950;
  cursor: pointer;
  list-style: none;
}

.inline-pill-button {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 10px;
  border: 1px solid rgba(24, 63, 53, 0.18);
  border-radius: 999px;
  color: #11181c;
  background: rgba(24, 63, 53, 0.10);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 950;
  cursor: pointer;
}

.inline-pill-button:hover,
.inline-pill-button:focus-visible {
  color: #fffaf1;
  background: #11181c;
}

.production-order-button {
  min-height: 28px;
  padding-inline: 12px;
  white-space: nowrap;
}

.return-reasons-details summary::-webkit-details-marker {
  display: none;
}

.return-reasons-details summary::after {
  margin-left: 7px;
  content: "▾";
  font-size: 0.7rem;
}

.return-reasons-details[open] summary::after {
  content: "▴";
}

.return-reasons-panel {
  display: grid;
  gap: 9px;
  width: min(420px, calc(100vw - 80px));
  padding: 13px;
  border: 1px solid rgba(16, 18, 23, 0.12);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 250, 241, 0.98);
  box-shadow: 0 22px 70px rgba(16, 18, 23, 0.20);
}

.return-reasons-panel > strong {
  color: #a63820;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.return-reasons-panel ul {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.return-reasons-panel li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(16, 18, 23, 0.08);
  font-size: 0.83rem;
  font-weight: 850;
}

.return-reasons-panel li:last-child {
  border-bottom: 0;
}

.return-reasons-panel li span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.return-reasons-panel li b {
  flex: 0 0 auto;
  color: #7b2b1c;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.production-order-panel {
  width: min(680px, calc(100vw - 80px));
}

.production-order-panel > strong,
.production-order-panel li b {
  color: #11181c;
}

.production-order-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 850;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 18px;
  background: rgba(16, 18, 23, 0.52);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(1180px, calc(100vw - 36px));
  max-height: min(820px, calc(100vh - 36px));
  overflow: auto;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid rgba(255, 250, 241, 0.36);
  border-radius: 26px;
  background: rgba(255, 250, 241, 0.98);
  box-shadow: 0 32px 100px rgba(16, 18, 23, 0.34);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.modal-heading h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.modal-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.35;
}

.modal-close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(16, 18, 23, 0.12);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.modal-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.modal-summary-grid span {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
  font-size: 0.8rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.modal-summary-grid strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.modal-table-wrap {
  max-width: 100%;
  overflow: auto;
  max-height: 500px;
}

.production-order-table {
  min-width: 860px;
  border-spacing: 0 6px;
}

.production-order-table th,
.production-order-table td {
  padding: 8px 8px;
  font-size: 0.82rem;
}

.production-order-table .production-material-col {
  width: 38%;
}

.production-order-table .production-package-col {
  width: 7%;
}

.production-order-table .production-quantity-col {
  width: 12%;
}

.production-order-table .production-unit-col {
  width: 7%;
}

.production-order-table .production-batch-col {
  width: 12%;
}

.production-order-table .production-date-col {
  width: 12%;
}

.production-order-table tr td:first-child {
  color: var(--muted);
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.production-order-table .code-cell {
  color: #6f7786;
  font-weight: 900;
  white-space: nowrap;
}

.return-reasons-modal {
  width: min(820px, calc(100vw - 36px));
}

.return-reasons-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.return-reasons-table {
  min-width: 620px;
}

.return-reasons-table .return-reason-col {
  width: auto;
}

.return-reasons-table .return-quantity-col,
.return-reasons-table .return-documents-col {
  width: 22%;
}

.return-reasons-table tr td:first-child {
  color: var(--ink);
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.delivery-routes-table {
  min-width: 1040px;
}

.delivery-routes-table .delivery-route-col {
  width: 9%;
}

.delivery-routes-table .delivery-date-col {
  width: 11%;
}

.delivery-routes-table .delivery-carrier-col {
  width: auto;
}

.delivery-routes-table .delivery-count-col {
  width: 8%;
}

.delivery-routes-table .delivery-money-col {
  width: 13%;
}

.delivery-routes-table .delivery-status-col {
  width: 12%;
}

.delivery-routes-table tr td:nth-child(3) {
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.monitor-shell {
  display: grid;
  gap: 18px;
}

.monitor-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 2px;
}

.monitor-toolbar h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 950;
  letter-spacing: -0.04em;
}

.monitor-refresh-state,
.route-modal-state {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  overflow: hidden;
  min-width: 180px;
  padding: 9px 12px;
  border: 1px solid rgba(24, 63, 53, 0.14);
  border-radius: 16px;
  color: #11181c;
  background: rgba(232, 247, 239, 0.78);
  font-size: 0.78rem;
  font-weight: 900;
}

.monitor-refresh-state::after,
.route-modal-state::after {
  position: absolute;
  inset: 0 auto 0 -45%;
  width: 38%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  content: "";
  transform: skewX(-18deg);
  animation: monitor-scan 2.4s linear infinite;
  pointer-events: none;
}

@keyframes monitor-scan {
  to {
    left: 112%;
  }
}

.monitor-refresh-state strong {
  font-size: 0.84rem;
  font-weight: 950;
}

.monitor-refresh-state span {
  color: var(--muted);
}

.monitor-refresh-state.is-error,
.route-modal-state.is-error {
  color: #7b2b1c;
  border-color: rgba(166, 56, 32, 0.18);
  background: rgba(255, 106, 42, 0.12);
}

.monitor-date-filter {
  grid-column: span 3;
  max-width: 360px;
}

.monitor-date-input {
  min-height: 40px;
}

.monitor-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.monitor-state-card {
  --state-color: #7b2b1c;
  --state-soft: rgba(255, 240, 226, 0.94);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 150px;
  border-color: color-mix(in srgb, var(--state-color) 24%, rgba(16, 18, 23, 0.10));
  background: linear-gradient(135deg, var(--state-soft), rgba(255, 250, 241, 0.92));
}

.monitor-state-card.is-pending {
  --state-color: #a63820;
  --state-soft: rgba(255, 238, 221, 0.96);
}

.monitor-state-card.is-progress {
  --state-color: #b8730e;
  --state-soft: rgba(255, 245, 202, 0.96);
}

.monitor-state-card.is-completed {
  --state-color: #187954;
  --state-soft: rgba(214, 245, 224, 0.96);
}

.monitor-state-card strong {
  color: var(--state-color);
}

.monitor-state-icon {
  display: inline-grid !important;
  place-items: center;
  width: clamp(58px, 5vw, 78px);
  height: clamp(58px, 5vw, 78px);
  border-radius: 24px;
  color: var(--state-color) !important;
  background: color-mix(in srgb, var(--state-color) 14%, rgba(255, 255, 255, 0.72));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--state-color) 22%, transparent);
}

.monitor-state-icon .ui-icon {
  width: 52%;
  height: 52%;
}

.monitor-progress-card {
  --delivery-tone: #11181c;
  --delivery-fill: 0%;
  --monitor-soft-tone: rgba(232, 247, 239, 0.78);
  border-color: color-mix(in srgb, var(--delivery-tone) 24%, rgba(16, 18, 23, 0.10));
  background: linear-gradient(135deg, var(--monitor-soft-tone), rgba(255, 250, 241, 0.92));
}

.monitor-progress-card strong,
.monitor-progress-card .delivery-percent {
  color: var(--delivery-tone);
}

.monitor-progress-card .delivery-today-values {
  align-items: center;
  gap: 8px;
}

.monitor-progress-card .delivery-today-values strong {
  font-size: clamp(1.7rem, 2.15vw, 2.28rem);
}

.monitor-progress-card .delivery-percent {
  font-size: clamp(0.98rem, 1.15vw, 1.22rem);
  letter-spacing: 0;
  white-space: nowrap;
}

.monitor-progress-card .delivery-progress span {
  width: max(6px, var(--delivery-fill));
}

.monitor-routes-table {
  min-width: 1120px;
}

.monitor-routes-card {
  padding: 14px 16px;
}

.monitor-routes-card .card-heading {
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.monitor-routes-card .card-heading > div {
  min-width: 0;
}

.monitor-routes-card .eyebrow {
  margin-bottom: 3px;
  font-size: 0.64rem;
  letter-spacing: 0.13em;
}

.monitor-routes-card .card-heading h2 {
  font-size: 1rem;
}

.monitor-routes-card .chart-insight {
  margin-top: 3px;
  font-size: 0.78rem;
  line-height: 1.2;
}

.monitor-routes-card .metric-chip {
  min-height: 32px;
  padding: 6px 11px;
}

.monitor-routes-card .ranking-table-wrap {
  max-height: min(calc(100vh - 170px), 980px);
}

.monitor-routes-card .ranking-table {
  border-spacing: 0 5px;
}

.monitor-routes-card .ranking-table th {
  padding: 6px 10px;
  font-size: 0.66rem;
}

.monitor-routes-card .ranking-table td {
  padding: 8px 10px;
  font-size: 0.82rem;
}

.monitor-routes-table .monitor-route-col {
  width: 9%;
}

.monitor-routes-table .monitor-carrier-col {
  width: auto;
}

.monitor-routes-table .monitor-count-col {
  width: 10%;
}

.monitor-routes-table .monitor-progress-col {
  width: 18%;
}

.monitor-routes-table .monitor-money-col {
  width: 12%;
}

.monitor-routes-table .monitor-status-col {
  width: 10%;
}

.monitor-routes-table .monitor-map-col {
  width: 10%;
}

.monitor-routes-table .monitor-action-col {
  width: 15%;
}

.monitor-route-row.is-pending td {
  background: rgba(255, 240, 226, 0.92);
}

.monitor-route-row.is-partial td {
  background: rgba(255, 245, 202, 0.94);
}

.monitor-route-row.is-confirmed td {
  background: rgba(220, 247, 229, 0.96);
}

.monitor-carrier-cell,
.route-client-cell,
.route-address-cell {
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.monitor-row-progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  margin-bottom: 4px;
  border-radius: 999px;
  background: rgba(16, 18, 23, 0.10);
}

.monitor-row-progress span {
  display: block;
  width: max(5px, var(--monitor-row-fill));
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d88410, #f59f2f 54%, #11181c);
}

.monitor-row-progress + b {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.monitor-detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 11px;
  border: 1px solid rgba(16, 18, 23, 0.12);
  border-radius: 999px;
  color: #fffaf1;
  background: #11181c;
  font-size: 0.72rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}

.monitor-map-button {
  color: #4f5664;
  background: rgba(120, 127, 140, 0.13);
  box-shadow: inset 0 0 0 1px rgba(93, 101, 115, 0.22);
}

.monitor-detail-button .ui-icon {
  width: 1em;
  height: 1em;
}

.monitor-detail-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(32, 63, 136, 0.20);
}

.monitor-map-button:hover {
  box-shadow: 0 10px 26px rgba(93, 101, 115, 0.16), inset 0 0 0 1px rgba(93, 101, 115, 0.34);
}

.monitor-empty-cell {
  border-radius: 15px !important;
  color: var(--muted) !important;
  text-align: center;
  white-space: normal !important;
}

.route-monitor-modal-panel {
  display: flex;
  flex-direction: column;
  width: min(1500px, calc(100vw - 48px));
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  overflow: hidden;
  padding: 12px 16px 14px;
}

.route-monitor-modal-panel .modal-heading {
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.route-monitor-modal-panel .modal-heading > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 12px;
  row-gap: 2px;
  min-width: 0;
}

.route-monitor-modal-panel .modal-heading .eyebrow {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.13em;
}

.route-monitor-modal-panel .modal-heading h2 {
  font-size: 1.12rem;
}

.route-monitor-modal-panel .modal-heading p {
  min-width: 0;
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-monitor-modal-panel .modal-close-button {
  width: 32px;
  height: 32px;
  font-size: 1.15rem;
}

.route-modal-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  min-width: max-content;
}

.route-monitor-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.route-monitor-summary span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 12px;
}

.route-monitor-summary strong {
  margin: 0;
  font-size: 0.62rem;
}

.route-monitor-summary b {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 950;
}

.route-modal-state {
  align-items: flex-start;
  width: fit-content;
  min-width: 0;
  margin: 0;
  padding: 4px 8px;
  border-radius: 11px;
  font-size: 0.7rem;
}

.route-documents-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.route-map-modal-panel {
  display: flex;
  flex-direction: column;
  width: min(1500px, calc(100vw - 48px));
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  overflow: hidden;
  padding: 12px 16px 14px;
}

.route-map-modal-panel .modal-heading {
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.route-map-modal-panel .modal-heading > div {
  min-width: 0;
}

.route-map-modal-panel .modal-heading h2 {
  font-size: 1.12rem;
}

.route-map-modal-panel .modal-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-map-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.route-map-summary span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 12px;
}

.route-map-summary strong {
  margin: 0;
  font-size: 0.62rem;
}

.route-map-summary b {
  font-size: 0.9rem;
  font-weight: 950;
}

.route-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.route-map-canvas {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.route-map-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.route-map-side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(16, 18, 23, 0.08);
}

.route-map-side-heading strong {
  font-size: 0.82rem;
}

.route-map-side-heading span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.route-map-stop-list {
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.route-map-stop {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 13px;
  background: rgba(255, 250, 241, 0.78);
}

.route-map-stop.is-delivered {
  background: rgba(211, 244, 224, 0.86);
}

.route-map-stop.is-confirmed {
  background: rgba(211, 244, 224, 0.86);
}

.route-map-stop.is-not-delivered {
  background: rgba(255, 245, 202, 0.92);
}

.route-map-stop.is-returned {
  background: rgba(255, 226, 220, 0.94);
}

.route-map-stop.is-unlocated {
  background: rgba(255, 238, 221, 0.92);
}

.route-map-stop.is-factory {
  background: rgba(255, 250, 241, 0.96);
  border: 1px solid rgba(24, 63, 53, 0.14);
}

.route-map-stop b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #fffaf1;
  background: #11181c;
  font-size: 0.74rem;
  font-weight: 950;
}

.route-map-stop.is-factory b {
  color: #11181c;
  background: #fffaf1;
  border: 2px solid #11181c;
}

.route-map-stop div {
  min-width: 0;
}

.route-map-stop strong,
.route-map-stop span,
.route-map-stop small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-map-stop strong {
  font-size: 0.78rem;
  line-height: 1.18;
}

.route-map-stop span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.route-map-stop small {
  margin-top: 2px;
  color: #6f7583;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.18;
}

.route-map-unlocated {
  margin: 0 8px 8px;
  padding: 8px;
  border: 1px dashed rgba(166, 56, 32, 0.28);
  border-radius: 13px;
  color: #78230f;
  background: rgba(255, 238, 221, 0.82);
  font-size: 0.7rem;
  font-weight: 850;
}

.route-map-marker {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  margin: calc(-14px + var(--marker-offset-y, 0px)) 0 0 calc(-14px + var(--marker-offset-x, 0px)) !important;
  border: 2px solid #fffaf1;
  border-radius: 999px;
  box-sizing: border-box;
  color: #fffaf1;
  background: #11181c;
  box-shadow: 0 8px 18px rgba(16, 18, 23, 0.26);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.route-map-marker.is-offset {
  z-index: 650 !important;
}

.route-map-marker.is-not-delivered {
  color: #4f3500;
  background: #f8c94c;
}

.route-map-marker.is-returned {
  color: #fffaf1;
  background: #b33124;
}

.route-map-marker-factory {
  width: 32px !important;
  height: 32px !important;
  margin: -16px 0 0 -16px !important;
  border-color: #11181c;
  color: #11181c;
  background: #fffaf1;
  box-shadow: 0 10px 22px rgba(16, 18, 23, 0.30);
  font-size: 0.8rem;
}

.route-map-truck-marker {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 30px !important;
  height: 30px !important;
  margin: -15px 0 0 -15px !important;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #e8f3ff;
  box-shadow: 0 10px 24px rgba(34, 118, 210, 0.35);
  font-size: 1rem;
  line-height: 1;
}

.route-map-completed-line {
  stroke-dasharray: 12 12;
  animation: routeCompletedDash 1.25s linear infinite;
}

@keyframes routeCompletedDash {
  from {
    stroke-dashoffset: 24;
  }

  to {
    stroke-dashoffset: 0;
  }
}

.route-map-popup {
  min-width: 190px;
  font-family: Manrope, system-ui, sans-serif;
}

.route-map-popup strong,
.route-map-popup span,
.route-map-popup small {
  display: block;
}

.route-map-popup strong {
  margin-bottom: 4px;
  color: var(--ink);
}

.route-map-popup span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.route-documents-table {
  min-width: 1210px;
  border-spacing: 0 3px;
}

.route-documents-table .route-document-order-col {
  width: 6%;
}

.route-documents-table .route-document-client-col {
  width: 19%;
}

.route-documents-table .route-document-note-col {
  width: 14%;
}

.route-documents-table .route-document-address-col {
  width: 26%;
}

.route-documents-table .route-document-window-col {
  width: 15%;
}

.route-documents-table .route-document-packages-col {
  width: 6%;
}

.route-documents-table .route-document-delay-col {
  width: 9%;
}

.route-documents-table .route-document-status-col {
  width: 12%;
}

.route-documents-table th {
  padding: 5px 8px;
  font-size: 0.64rem;
}

.route-documents-table td {
  padding: 6px 8px;
  font-size: 0.72rem;
  line-height: 1.12;
}

.route-documents-table .route-client-cell,
.route-documents-table .route-address-cell {
  font-weight: 850;
}

.route-documents-table .route-delay-cell {
  color: #11181c;
  font-weight: 950;
  white-space: nowrap;
}

.route-documents-table .route-delay-cell.is-start {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
}

.route-documents-table .status-pill {
  min-height: 22px;
  padding: 3px 7px;
  font-size: 0.62rem;
}

.route-document-row.is-pending td {
  background: rgba(255, 238, 221, 0.98);
}

.route-document-row.is-confirmed td {
  background: rgba(214, 245, 224, 0.98);
}

.route-document-row.is-not-delivered td {
  background: rgba(255, 245, 202, 0.98);
}

.route-document-row.is-returned td {
  background: rgba(255, 226, 220, 0.98);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 950;
  white-space: nowrap;
}

.status-pill.is-pending {
  color: #78230f;
  background: rgba(255, 106, 42, 0.22);
  box-shadow: inset 0 0 0 1px rgba(166, 56, 32, 0.24);
}

.status-pill.is-partial {
  color: #6b3d00;
  background: rgba(248, 177, 33, 0.26);
  box-shadow: inset 0 0 0 1px rgba(184, 115, 14, 0.24);
}

.status-pill.is-confirmed {
  color: #11181c;
  background: rgba(24, 121, 84, 0.20);
  box-shadow: inset 0 0 0 1px rgba(24, 121, 84, 0.24);
}

.status-pill.is-not-delivered {
  color: #6b3d00;
  background: rgba(248, 177, 33, 0.30);
  box-shadow: inset 0 0 0 1px rgba(159, 105, 0, 0.24);
}

.status-pill.is-returned {
  color: #8f2118;
  background: rgba(195, 54, 42, 0.18);
  box-shadow: inset 0 0 0 1px rgba(195, 54, 42, 0.25);
}

.production-order-list {
  display: grid;
  gap: 10px;
}

.production-order-block {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
}

.production-order-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.production-order-header strong,
.production-order-header span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.production-order-header strong {
  color: #fffaf1;
  background: #11181c;
}

.return-bar-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.return-bar-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.62);
}

.return-bar-meta strong {
  margin-left: 4px;
  color: #7b2b1c;
  font-weight: 950;
}

.empty-state-card {
  padding: 18px;
  border: 1px dashed rgba(16, 18, 23, 0.16);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
  font-weight: 850;
}

.ranking-table {
  min-width: 700px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  table-layout: fixed;
}

.ranking-table .col-code {
  width: 13%;
}

.ranking-table .col-name {
  width: auto;
}

.ranking-table .col-quantity {
  width: 19%;
}

.ranking-table .col-money {
  width: 18%;
}

.ranking-table .col-percent {
  width: 17%;
}

.ranking-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255, 250, 241, 0.94);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

.ranking-table th button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 32px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.ranking-table th.number-cell button {
  justify-content: flex-end;
  width: 100%;
}

.ranking-table th button::after {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 6px;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 999px;
  color: rgba(112, 118, 132, 0.84);
  background: rgba(255, 255, 255, 0.58);
  content: "sort";
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ranking-table th[aria-sort="ascending"] button,
.ranking-table th[aria-sort="descending"] button {
  color: var(--ink);
}

.ranking-table th[aria-sort="ascending"] button::after {
  color: #fffaf1;
  border-color: transparent;
  background: var(--green);
  content: "asc";
}

.ranking-table th[aria-sort="descending"] button::after {
  color: #fffaf1;
  border-color: transparent;
  background: var(--blue);
  content: "desc";
}

.ranking-table th button:focus-visible {
  outline: 3px solid rgba(255, 106, 42, 0.22);
  outline-offset: 3px;
  border-radius: 8px;
}

.ranking-table td {
  padding: 13px 12px;
  background: rgba(255, 255, 255, 0.56);
  font-size: 0.9rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.ranking-table tr td:first-child {
  border-radius: 15px 0 0 15px;
  color: var(--muted);
  white-space: nowrap;
}

.code-cell {
  font-variant-numeric: tabular-nums;
}

.ranking-table tr td:last-child {
  border-radius: 0 15px 15px 0;
}

.number-cell {
  text-align: right !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.is-positive {
  color: #135d3b;
}

.is-negative {
  color: #a63820;
}

.is-neutral {
  color: var(--muted);
}

/* widget responsive inserted */

@media (max-width: 980px) {
  .widget-aggregator {
    grid-template-columns: 1fr;
  }

  .widget-aggregator-actions {
    grid-template-columns: 1fr 1fr;
  }

  .widget-aggregator-actions select {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .widget-aggregator {
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 22px;
  }

  .widget-aggregator-actions {
    grid-template-columns: 1fr;
  }

  .widget-add-button,
  .widget-reset-button {
    justify-content: center;
    width: 100%;
  }
}

@media (max-width: 980px) {
  .login-card,
  .hero-panel,
  .dashboard-grid,
  .filter-panel,
  .filter-body {
    grid-template-columns: 1fr;
  }

  .filter-summary {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .filter-toggle-text {
    justify-self: start;
  }

  .dashboard-hero {
    min-height: auto;
  }

  .dashboard-hero h1 {
    font-size: clamp(2.35rem, 6.5vw, 3.7rem);
  }

  .hero-visual {
    min-height: 200px;
  }

  .hero-orbit {
    right: 50%;
    transform: translateX(50%);
  }

  .hero-mini-card-b {
    left: 24px;
  }

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

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

  .selection-bar-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .login-copy {
    min-height: 360px;
  }

  .login-form {
    min-height: auto;
  }

  .chart-card canvas {
    height: 280px !important;
  }

  .wide-card #monthlySalesChart {
    height: 310px !important;
  }

  .delivery-zone-map-layout {
    grid-template-columns: 1fr;
  }

  .delivery-zone-map-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 981px) and (max-height: 820px) {
  .login-screen {
    min-height: calc(100vh - 24px);
    padding: 6px 0;
  }

  .login-card {
    width: min(1040px, 100%);
    max-height: calc(100vh - 24px);
  }

  .login-copy,
  .login-form {
    min-height: min(500px, calc(100vh - 24px));
    padding: clamp(24px, 3.4vw, 42px);
  }

  .login-copy .eyebrow {
    margin-bottom: 10px;
    font-size: clamp(0.96rem, 1.2vw, 1.16rem);
  }

  .login-brand-lockup {
    gap: 14px;
    margin-bottom: 14px;
  }

  .login-brand-lockup img {
    width: clamp(92px, 9vw, 124px);
    border-radius: 14px;
  }

  .monark-wordmark span {
    font-size: clamp(2.35rem, 3.25vw, 3.65rem);
  }

  .monark-wordmark strong {
    font-size: clamp(2.3rem, 3.1vw, 3.5rem);
  }

  .login-copy p:not(.eyebrow) {
    margin-top: 14px;
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .login-dashboard-visual {
    min-height: 104px;
    margin-top: 18px;
    padding: 12px;
    border-radius: 22px;
  }

  .login-visual-header {
    margin-bottom: 10px;
  }

  .login-visual-metrics {
    gap: 8px;
    margin-bottom: 9px;
  }

  .login-visual-metrics span {
    min-height: 34px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .login-visual-chart {
    height: 54px;
    border-radius: 15px;
  }

  .login-form {
    gap: 7px;
  }

  .login-form::before {
    inset: 16px;
    border-radius: 24px;
  }

  .login-form label {
    margin-top: 8px;
    font-size: 0.72rem;
  }

  .login-form input {
    min-height: 46px;
    padding: 11px 14px;
    border-radius: 15px;
  }

  .login-form .primary-button {
    min-height: 46px;
    margin-top: 12px;
  }

  .route-monitor-modal-panel {
    width: min(1540px, calc(100vw - 20px));
    height: calc(100vh - 18px);
    max-height: calc(100vh - 18px);
    padding: 9px 12px 10px;
    border-radius: 20px;
  }

  .route-map-modal-panel {
    width: min(1540px, calc(100vw - 20px));
    height: calc(100vh - 18px);
    max-height: calc(100vh - 18px);
    padding: 9px 12px 10px;
    border-radius: 20px;
  }

  .route-monitor-modal-panel .modal-heading {
    margin-bottom: 5px;
  }

  .route-map-modal-panel .modal-heading {
    margin-bottom: 5px;
  }

  .route-modal-actions {
    gap: 6px;
  }

  .route-monitor-modal-panel .modal-heading .eyebrow {
    display: none;
  }

  .route-map-modal-panel .modal-heading .eyebrow {
    display: none;
  }

  .route-monitor-modal-panel .modal-heading h2 {
    font-size: 1rem;
  }

  .route-map-modal-panel .modal-heading h2 {
    font-size: 1rem;
  }

  .route-monitor-modal-panel .modal-heading p {
    font-size: 0.7rem;
  }

  .route-map-modal-panel .modal-heading p {
    font-size: 0.7rem;
  }

  .route-monitor-summary {
    gap: 5px;
    margin-bottom: 5px;
  }

  .route-monitor-summary span {
    min-height: 30px;
    padding: 5px 8px;
  }

  .route-monitor-summary b {
    font-size: 0.82rem;
  }

  .route-map-summary {
    gap: 5px;
    margin-bottom: 5px;
  }

  .route-map-summary span {
    min-height: 30px;
    padding: 5px 8px;
  }

  .route-map-summary b {
    font-size: 0.82rem;
  }

  .route-modal-state {
    padding: 3px 7px;
    font-size: 0.66rem;
  }

  .monitor-routes-card {
    padding: 12px;
  }

  .monitor-routes-card .card-heading {
    margin-bottom: 6px;
  }

  .monitor-routes-card .eyebrow {
    margin-bottom: 2px;
    font-size: 0.6rem;
  }

  .monitor-routes-card .chart-insight {
    font-size: 0.72rem;
  }

  .monitor-routes-card .metric-chip {
    min-height: 28px;
    padding: 5px 9px;
    font-size: 0.68rem;
  }

  .monitor-routes-card .ranking-table-wrap {
    max-height: calc(100vh - 116px);
  }

  .monitor-routes-card .ranking-table th {
    padding: 5px 7px;
    font-size: 0.6rem;
  }

  .monitor-routes-card .ranking-table td {
    padding: 6px 7px;
    font-size: 0.74rem;
  }

  .route-map-layout {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
    gap: 8px;
  }

  .route-map-side-heading {
    padding: 8px 10px;
  }

  .route-map-stop-list {
    gap: 5px;
    padding: 6px;
  }

  .route-map-stop {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 7px;
    padding: 6px;
  }

  .route-map-stop b {
    width: 24px;
    height: 24px;
    font-size: 0.68rem;
  }

  .route-documents-table {
    border-spacing: 0 2px;
  }

  .route-documents-table th {
    padding: 4px 6px;
    font-size: 0.6rem;
  }

  .route-documents-table td {
    padding: 5px 6px;
    font-size: 0.68rem;
    line-height: 1.08;
  }

  .route-documents-table .status-pill {
    min-height: 20px;
    padding: 2px 6px;
    font-size: 0.58rem;
  }
}

@media (min-width: 981px) and (max-height: 680px) {
  .login-dashboard-visual {
    min-height: 92px;
    margin-top: 12px;
  }

  .login-visual-metrics {
    display: none;
  }

  .login-visual-chart {
    height: 54px;
  }
}

@media (max-width: 620px) {
  html {
    font-size: 14px;
  }

  .app-shell {
    padding: 12px 10px 28px;
  }

  .topbar,
  .logout-form {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 22px;
  }

  .logout-form,
  .logout-form .ghost-button,
  .user-pill {
    width: 100%;
  }

  .logout-form .ghost-button,
  .user-pill {
    justify-content: center;
  }

  .login-screen {
    min-height: calc(100vh - 24px);
    place-items: start stretch;
  }

  .login-copy {
    min-height: 260px;
    padding: 28px;
  }

  .login-brand-lockup {
    gap: 12px;
    margin-bottom: 18px;
  }

  .login-brand-lockup img {
    width: clamp(88px, 24vw, 112px);
  }

  .delivery-zone-map {
    min-height: 310px;
  }

  .delivery-zone-map-summary {
    grid-template-columns: 1fr;
  }

  .login-copy .eyebrow {
    font-size: 1.15rem;
  }

  .monark-wordmark span,
  .monark-wordmark strong {
    font-size: clamp(2.6rem, 13vw, 3.8rem);
  }

  .login-dashboard-visual {
    min-height: 118px;
    margin-top: 22px;
    padding: 12px;
    border-radius: 22px;
  }

  .login-visual-header {
    margin-bottom: 12px;
  }

  .login-visual-metrics {
    gap: 7px;
    margin-bottom: 10px;
  }

  .login-visual-metrics span {
    min-height: 38px;
    padding: 9px 10px;
    border-radius: 11px;
  }

  .login-visual-chart {
    height: 60px;
    border-radius: 15px;
  }

  .login-visual-line {
    display: none;
  }

  .login-form {
    padding: 26px 20px;
  }

  .login-form::before {
    inset: 12px;
    border-radius: 22px;
  }

  .hero-panel {
    margin-bottom: 16px;
    padding: 20px 16px;
  }

  .hero-topline {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 0;
  }

  .hero-logout-form {
    width: 100%;
  }

  .hero-user-pill,
  .hero-logout-button {
    flex: 1;
  }

  .hero-panel h1 {
    font-size: clamp(2.35rem, 13vw, 3.8rem);
    letter-spacing: -0.065em;
  }

  .dashboard-hero h1 {
    font-size: clamp(2.25rem, 11vw, 3.15rem);
  }

  .hero-text {
    margin-top: 12px;
    font-size: 0.94rem;
    line-height: 1.45;
  }

  .hero-context {
    gap: 8px;
    margin-top: 12px;
  }

  .hero-context span {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    border-radius: 18px;
  }

  .hero-visual {
    min-height: 170px;
  }

  .hero-orbit {
    width: 220px;
    right: 0;
    transform: none;
  }

  .hero-signal-card {
    right: 0;
    bottom: 0;
    width: min(235px, 100%);
    padding: 12px;
  }

  .signal-bars {
    height: 58px;
    gap: 7px;
  }

  .hero-mini-card {
    min-width: 92px;
    padding: 11px 12px;
    border-radius: 18px;
  }

  .hero-mini-card-a {
    top: 0;
    right: 12px;
  }

  .hero-mini-card-b {
    top: 56px;
    left: 0;
  }

  .hero-route-line {
    display: none;
  }

  .filter-panel {
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 22px;
  }

  .filter-summary {
    gap: 10px;
    min-height: 0;
    padding: 10px;
    border-radius: 18px;
  }

  .filter-summary-chips {
    gap: 6px;
  }

  .filter-summary-chips span {
    max-width: 100%;
    width: 100%;
    border-radius: 16px;
    white-space: normal;
  }

  .filter-toggle-text {
    width: 100%;
  }

  .filter-body {
    gap: 10px;
    margin-top: 10px;
  }

  .filter-group {
    grid-column: 1 / -1;
    padding: 10px;
    border-radius: 16px;
  }

  .monitor-date-filter {
    max-width: none;
  }

  .filter-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .filter-tools {
    width: 100%;
  }

  .filter-tools button {
    flex: 1;
  }

  .chip-list {
    max-height: 145px;
  }

  .compact-list {
    max-height: 120px;
  }

  .filter-chip span {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 0.72rem;
    line-height: 1.25;
    white-space: normal;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }

  .selection-bar {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: -4px 0 16px;
  }

  .selection-bar div {
    padding: 12px 14px;
    border-radius: 18px;
  }

  .kpi-card strong {
    white-space: normal;
  }

  .kpi-card,
  .chart-card {
    border-radius: 22px;
  }

  .kpi-card {
    min-height: 132px;
    padding: 18px;
  }

  .chart-card {
    padding: 16px;
  }

  .chart-card canvas {
    height: 235px !important;
  }

  .variation-delta-chart {
    gap: 10px;
    padding: 12px;
  }

  .variation-delta-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .variation-delta-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .variation-explain-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .variation-explain-values span {
    white-space: normal;
  }

  .delivery-today-values {
    align-items: flex-start;
  }

  .delivery-percent {
    text-align: right;
  }

  .delivery-cycle-heatmap {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .delivery-cycle-row {
    min-width: 820px;
    grid-template-columns: 210px repeat(3, 130px) 110px;
  }

  .delivery-delay-row {
    grid-template-columns: 62px minmax(0, 1fr) 44px 48px 54px;
    gap: 8px;
  }

  .delivery-delay-row em {
    grid-column: 2 / 3;
    text-align: left;
  }

  .delivery-delay-detail-button {
    grid-column: 5 / 6;
  }

  .wide-card #monthlySalesChart {
    height: 260px !important;
  }

  .card-heading {
    gap: 10px;
    margin-bottom: 14px;
  }

  .card-heading h2 {
    font-size: 1rem;
  }

  .ranking-chart-scroll,
  .ranking-table-wrap {
    max-height: 520px;
  }

  .ranking-table {
    min-width: 560px;
  }

  .profitability-table {
    min-width: 820px;
  }

  .ranking-table th,
  .ranking-table td {
    padding: 10px;
    font-size: 0.78rem;
  }

  .ranking-table th button::after {
    content: "";
    width: 7px;
    height: 7px;
    min-height: 0;
    padding: 0;
  }

  .ranking-table th[aria-sort="ascending"] button::after,
  .ranking-table th[aria-sort="descending"] button::after {
    content: "";
  }

  .return-bar-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .return-bar-rank {
    width: max-content;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
  }

  .return-bar-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .return-bar-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .return-bar-title span {
    white-space: normal;
  }

  .return-bar-metric {
    font-size: 0.88rem;
  }

  .return-reasons-panel {
    width: 100%;
  }

  .return-reasons-panel li {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .return-reasons-panel li span {
    white-space: normal;
  }

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

  .tab-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-radius: 22px;
    scroll-snap-type: x mandatory;
  }

  .tab-strip button {
    flex: 0 0 min(46vw, 180px);
    scroll-snap-align: start;
  }

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

  .modal-summary-grid {
    grid-template-columns: 1fr;
  }

  .modal-card {
    border-radius: 22px;
  }

  .route-map-modal-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
    padding: 10px;
  }

  .route-map-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 1fr) minmax(180px, 36vh);
  }

  .route-map-summary {
    grid-template-columns: 1fr;
  }

  .slim-button,
  .reset-link {
    justify-content: center;
    width: 100%;
  }

  .hero-panel,
  .login-card {
    border-radius: 24px;
  }

  .status-card {
    min-height: 150px;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-inline: 8px;
  }

  .tab-strip button {
    flex-basis: 62vw;
  }

  .filter-title,
  .eyebrow {
    letter-spacing: 0.1em;
  }

  .chart-card canvas {
    height: 220px !important;
  }

  .wide-card #monthlySalesChart {
    height: 240px !important;
  }
}

.profitability-table {
  min-width: 980px;
}

.channel-sales-card canvas {
  height: clamp(360px, 31vw, 430px) !important;
}

.channel-share-card canvas {
  height: clamp(340px, 28vw, 390px) !important;
}

@media (max-width: 920px) {
  .channel-sales-card canvas {
    height: 330px !important;
  }

  .channel-share-card canvas {
    height: 315px !important;
  }
}

@media (max-width: 620px) {
  .channel-sales-card canvas,
  .channel-share-card canvas {
    height: 285px !important;
  }
}

/* Production monitor */
.production-monitor-shell {
  --production-ink: #152a27;
  --production-teal: #176b5b;
  --production-teal-soft: #dff3ed;
  --production-tomato: #d95032;
  --production-tomato-soft: #fff0e9;
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.production-monitor-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  padding: 12px 16px;
  border: 1px solid rgba(23, 107, 91, 0.18);
  border-radius: 18px;
  color: #f7fffc;
  background: linear-gradient(105deg, rgba(15, 54, 48, 0.98), rgba(23, 107, 91, 0.92));
  box-shadow: 0 12px 34px rgba(20, 58, 52, 0.16);
}

.production-monitor-hero::after {
  position: absolute;
  right: -34px;
  bottom: -76px;
  width: 170px;
  height: 170px;
  border: 24px solid rgba(255, 255, 255, 0.055);
  border-radius: 50%;
  content: "";
}

.production-monitor-hero > * { position: relative; z-index: 1; }
.production-monitor-hero .eyebrow { color: #d3f8ee; font-size: 12px; }
.production-monitor-hero-copy { min-width: 0; }
.production-monitor-hero h1 { margin: 1px 0 2px; font-size: clamp(1.35rem, 2.3vw, 1.75rem); font-weight: 950; letter-spacing: -0.035em; line-height: 1.05; }
.production-monitor-hero p { margin: 0; color: #f7fffc; font-size: 12px; line-height: 1.35; }

.production-monitor-status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 205px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  background: rgba(8, 35, 31, 0.34);
  backdrop-filter: blur(8px);
}

.production-monitor-status-copy { display: grid; min-width: 0; gap: 2px; }
.production-monitor-status strong { font-size: 12px; }
.production-monitor-status [data-production-monitor-status-detail] { color: rgba(247, 255, 252, 0.92); font-size: 12px; line-height: 1.35; }

.production-live-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #75e2bd;
  box-shadow: 0 0 0 5px rgba(117, 226, 189, 0.14);
  animation: production-live-pulse 2.4s ease-in-out infinite;
}

.production-monitor-status.is-error .production-live-dot { background: #ff9b7d; box-shadow: 0 0 0 5px rgba(255, 155, 125, 0.14); animation: none; }

.production-kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.production-kpi-strip article {
  position: relative;
  display: grid;
  gap: 2px;
  min-height: 128px;
  overflow: hidden;
  padding: 18px 20px;
  border: 1px solid rgba(21, 42, 39, 0.09);
  border-radius: 19px;
  background: linear-gradient(145deg, #ffffff, #f7faf8);
  box-shadow: 0 13px 34px rgba(26, 65, 58, 0.08);
}

.production-kpi-strip article::after { position: absolute; right: -22px; bottom: -28px; width: 88px; height: 88px; border-radius: 50%; background: rgba(23, 107, 91, 0.06); content: ""; }
.production-kpi-strip article.is-recipe { border-color: rgba(217, 80, 50, 0.2); background: linear-gradient(145deg, #fffdfb, var(--production-tomato-soft)); }
.production-kpi-strip article.is-recipe::after { background: rgba(217, 80, 50, 0.08); }
.production-kpi-strip span { color: #62706d; font-size: 12px; font-weight: 850; letter-spacing: 0.05em; text-transform: uppercase; }
.production-kpi-strip strong { color: var(--production-ink); font-size: 2.05rem; font-weight: 950; font-variant-numeric: tabular-nums; line-height: 1.08; }
.production-kpi-strip small { align-self: end; color: #53615e; font-size: 12px; }

.production-monitor-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }
.production-panel { position: relative; width: 100%; min-width: 0; padding: 20px; border: 1px solid rgba(21, 42, 39, 0.1); border-radius: 22px; background: #fff; box-shadow: 0 16px 42px rgba(26, 65, 58, 0.075); }
.production-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 17px; padding-right: 118px; }
.production-panel-heading > div:first-child { flex: 1 1 auto; min-width: 0; }
.production-panel-heading > .widget-control-group { position: absolute; top: 14px; right: 14px; margin-left: 0; }
.production-panel-heading .eyebrow { color: #a83c27; font-size: 12px; }
.production-panel-heading h2 { margin: 2px 0 3px; color: var(--production-ink); font-size: 1.22rem; font-weight: 950; }
.production-panel-heading p { margin: 0; color: #53615e; font-size: 12px; }
.production-panel-count { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; color: var(--production-teal); background: var(--production-teal-soft); font-size: 12px; font-weight: 900; }
.production-machine-groups { display: grid; gap: 16px; max-height: 670px; overflow: auto; padding-right: 3px; }
.production-machine-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; padding-bottom: 7px; border-bottom: 1px solid rgba(21, 42, 39, 0.09); }
.production-machine-heading h3 { margin: 0; color: var(--production-ink); font-size: 12px; font-weight: 900; }
.production-machine-heading span { color: #53615e; font-size: 12px; font-weight: 800; }
.production-order-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.production-order-card { display: flex; flex-direction: column; min-width: 0; padding: 13px; border: 1px solid rgba(21, 42, 39, 0.1); border-radius: 15px; background: #fbfcfb; animation: production-reveal 220ms both; animation-delay: var(--production-delay, 0ms); }
.production-order-top { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.production-order-top > .production-order-detail-button { font-size: 12px; font-weight: 950; }
.production-order-detail-button {
  appearance: none;
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  margin: -2px -3px;
  padding: 2px 3px;
  border: 0;
  border-radius: 5px;
  color: var(--production-teal);
  background: transparent;
  font: inherit;
  font-weight: 900;
  line-height: 1.2;
  text-decoration: underline;
  text-decoration-color: rgba(23, 107, 91, 0.38);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
  touch-action: manipulation;
}
.production-order-detail-button::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  content: "";
  transform: translate(-50%, -50%);
}
.production-order-detail-button:hover { color: #0b4d41; background: rgba(23, 107, 91, 0.09); text-decoration-color: currentColor; }
.production-order-detail-button:active { color: #073b32; background: rgba(23, 107, 91, 0.16); }
.production-order-detail-button:focus-visible { outline: 2px solid var(--production-teal); outline-offset: 2px; text-decoration: none; }
.production-type-badge { display: inline-flex; align-items: center; max-width: 100%; min-height: 26px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 900; letter-spacing: 0.025em; line-height: 1.15; white-space: normal; text-transform: uppercase; }
.production-type-badge.is-recipe { color: #a83c27; background: var(--production-tomato-soft); }
.production-type-badge.is-final { color: var(--production-teal); background: var(--production-teal-soft); }
.production-order-card h4 { display: -webkit-box; min-height: 2.6em; overflow: hidden; margin: 10px 0 2px; color: #283b38; font-size: 12px; font-weight: 850; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.production-order-code { margin: 0 0 11px; color: #53615e; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.production-order-quantity { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 9px; border-top: 1px dashed rgba(21, 42, 39, 0.13); }
.production-order-quantity span { color: #53615e; font-size: 12px; }
.production-order-quantity strong { color: var(--production-ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.production-carryover { align-self: flex-start; margin-top: 8px; padding: 4px 7px; border-radius: 7px; color: #8a5a08; background: #fff3cf; font-size: 12px; font-weight: 850; }
.production-legend { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px 12px; color: #53615e; font-size: 12px; }
.production-legend span { display: inline-flex; align-items: center; gap: 5px; }
.production-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--production-teal); }
.production-legend i.is-recipe { background: var(--production-tomato); }
.production-legend i.is-continuation { width: 15px; border-radius: 2px; background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.48) 0 2px, transparent 2px 5px), var(--production-teal); clip-path: polygon(0 50%, 32% 0, 100% 0, 100% 100%, 32% 100%); }
.production-timeline-panel { --production-timeline-identity-width: 180px; --production-timeline-output-width: 128px; --production-timeline-gap: 12px; }
.production-timeline-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; padding-bottom: 5px; }
.production-timeline-scroll:focus-visible { outline: 3px solid var(--production-teal); outline-offset: 4px; }
.production-time-axis, .production-timeline { width: 100%; min-width: 0; }
.production-time-axis { box-sizing: border-box; margin: 0 0 7px; padding-inline: calc(var(--production-timeline-identity-width) + var(--production-timeline-gap)) calc(var(--production-timeline-output-width) + var(--production-timeline-gap)); color: #53615e; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.production-time-axis-ticks { display: flex; justify-content: space-between; min-width: 0; }
.production-timeline { display: grid; gap: 7px; }
.production-timeline-row { --timeline-color-start: #14594c; --timeline-color-end: #1d6757; display: grid; grid-template-columns: var(--production-timeline-identity-width) minmax(0, 1fr) var(--production-timeline-output-width); align-items: center; gap: var(--production-timeline-gap); min-height: 64px; animation: production-reveal 220ms both; animation-delay: var(--production-delay, 0ms); }
.production-timeline-row.is-recipe { --timeline-color-start: #9e341f; --timeline-color-end: #b74128; }
.production-timeline-identity { position: sticky; left: 0; z-index: 3; align-self: stretch; display: grid; align-content: center; box-sizing: border-box; min-width: 0; gap: 2px; padding-right: 8px; background: #fff; box-shadow: 9px 0 12px -14px rgba(21, 42, 39, 0.72); }
.production-timeline-title { display: flex; align-items: center; min-width: 0; gap: 4px; overflow: visible; color: var(--production-ink); font-size: 12px; font-weight: 900; white-space: nowrap; }
.production-timeline-title > span { flex: 0 0 auto; }
.production-timeline-title > span:last-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.production-timeline-title .production-order-detail-button { position: static; flex: 0 0 auto; font-size: 12px; }
.production-timeline-title .production-order-detail-button::before { inset: 0; width: auto; height: auto; transform: none; }
.production-timeline-identity span { overflow: hidden; color: #53615e; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.production-timeline-identity .production-timeline-context { overflow: visible; margin-top: 2px; color: #36504a; font-size: 11px; font-weight: 800; line-height: 1.35; overflow-wrap: break-word; text-overflow: clip; white-space: normal; }
.production-timeline-identity .production-timeline-schedule { overflow: visible; margin-top: 1px; color: #36504a; font-size: 11px; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1.2; text-overflow: clip; white-space: nowrap; }
.production-timeline-track { position: relative; height: 50px; overflow: visible; border-radius: 8px; background: repeating-linear-gradient(90deg, rgba(21, 42, 39, 0.075) 0 1px, transparent 1px 16.666%), #f4f7f5; }
.production-timeline-bar { --timeline-min-visible: 10px; position: absolute; top: 5px; bottom: 5px; left: min(var(--timeline-left), calc(100% - var(--timeline-min-visible))); display: flex; align-items: center; width: max(var(--timeline-width), var(--timeline-min-visible)); overflow: hidden; border: 0; border-radius: 6px; color: #fff; background: linear-gradient(90deg, var(--timeline-color-start), var(--timeline-color-end)); box-shadow: 0 5px 13px rgba(23, 107, 91, 0.2); font: inherit; cursor: pointer; touch-action: manipulation; transform-origin: left center; animation: production-bar-grow 260ms ease-out both; animation-delay: var(--production-delay, 0ms); }
.production-timeline-row.is-recipe .production-timeline-bar { box-shadow: 0 5px 13px rgba(158, 52, 31, 0.22); }
.production-timeline-row.is-incoming .production-timeline-bar, .production-timeline-row.is-outgoing .production-timeline-bar { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0 2px, transparent 2px 8px), linear-gradient(90deg, var(--timeline-color-start), var(--timeline-color-end)); }
.production-timeline-row.is-incoming .production-timeline-bar { border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
.production-timeline-row.is-outgoing .production-timeline-bar { border-top-right-radius: 2px; border-bottom-right-radius: 2px; }
.production-timeline-row.is-incoming .production-timeline-bar::before, .production-timeline-row.is-outgoing .production-timeline-bar::after { position: absolute; top: 0; bottom: 0; z-index: 1; width: 12px; background: rgba(255, 255, 255, 0.9); content: ""; pointer-events: none; }
.production-timeline-row.is-incoming .production-timeline-bar::before { left: 0; clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.production-timeline-row.is-outgoing .production-timeline-bar::after { right: 0; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.production-timeline-bar:focus-visible { outline: 2px solid #fff; outline-offset: -3px; box-shadow: inset 0 0 0 4px rgba(8, 35, 31, 0.82), 0 5px 13px rgba(23, 107, 91, 0.24); }
.production-timeline-meta { position: absolute; top: 31px; z-index: 2; display: block; max-width: 100%; overflow: hidden; color: #36504a; font-size: 11px; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1.15; text-overflow: clip; white-space: nowrap; pointer-events: none; }
.production-timeline-bar-hit { position: absolute; top: -5px; left: 0; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; touch-action: manipulation; }
.production-timeline-bar-hit .production-timeline-bar { top: 10px; right: 0; bottom: 10px; left: 0; width: 100%; pointer-events: none; }
.production-timeline-bar-hit:focus-visible { outline: 3px solid var(--production-teal); outline-offset: 2px; border-radius: 7px; }
.production-timeline-bar-hit:focus-visible .production-timeline-bar { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.94), 0 5px 13px rgba(23, 107, 91, 0.24); }
.production-output { display: grid; min-width: 0; gap: 1px; text-align: right; }
.production-output strong { color: var(--production-ink); font-size: 12px; font-weight: 950; }
.production-output span { overflow: hidden; color: #53615e; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.production-timeline-panel.is-widget-maximized {
  --production-timeline-identity-width: 248px;
  --production-timeline-row-height: 64px;
  padding:
    max(10px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left)) !important;
}
.production-timeline-panel.is-widget-maximized > .production-panel-heading {
  margin-bottom: 5px;
  padding: 0 58px 6px 0;
}
.production-timeline-panel.is-widget-maximized .production-panel-heading > .widget-control-group { top: 8px; right: 8px; }
.production-timeline-panel.is-widget-maximized .production-panel-heading h2 { margin-block: 0 1px; }
.production-timeline-panel.is-widget-maximized .production-timeline-scroll { padding-bottom: 0; }
.production-timeline-panel.is-widget-maximized .production-time-axis { margin-bottom: 4px; }
.production-timeline-panel.is-widget-maximized .production-timeline { gap: 3px; }
.production-timeline-panel.is-widget-maximized .production-timeline-row {
  height: var(--production-timeline-row-height);
  min-height: var(--production-timeline-row-height);
}
.production-timeline-panel.is-widget-maximized .production-timeline-identity { gap: 1px; }
.production-timeline-panel.is-widget-maximized .production-timeline-title,
.production-timeline-panel.is-widget-maximized .production-timeline-identity > span { line-height: 1.1; }
.production-timeline-panel.is-widget-maximized .production-timeline-identity .production-timeline-context {
  overflow: hidden;
  margin-top: 0;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.production-timeline-panel.is-widget-maximized .production-timeline-track { height: 50px; }
.production-timeline-panel.is-widget-maximized.has-adaptive-timeline-density:not(.is-timeline-overflowing) .production-timeline-scroll { overflow-y: hidden; }
.production-timeline-panel.is-widget-maximized.is-timeline-overflowing .production-timeline-scroll {
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.production-empty-state { padding: 30px 18px; border: 1px dashed rgba(21, 42, 39, 0.16); border-radius: 14px; color: #53615e; background: #f8faf9; font-size: 12px; text-align: center; }
.production-empty-state.is-error { color: #a5402d; border-color: rgba(217, 80, 50, 0.24); background: var(--production-tomato-soft); }
.production-loading-state { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.production-loading-state span { height: 142px; border-radius: 15px; background: #edf2ef; animation: production-loading 1.5s ease-in-out infinite; }
.production-monitor-shell.is-stale .production-panel, .production-monitor-shell.is-stale .production-kpi-strip { opacity: 0.78; }
.production-monitor-shell.is-refreshed .production-kpi-strip, .production-monitor-shell.is-refreshed .production-panel { animation: production-refresh 260ms ease-out; }
.production-order-detail-modal { width: min(1040px, calc(100vw - 36px)); }
.production-order-detail-modal .modal-heading { margin-bottom: 12px; }
.production-order-detail-modal .modal-close-button,
.production-order-journey-modal .modal-close-button { width: 44px; height: 44px; }
.production-order-detail-modal .modal-close-button:focus-visible,
.production-order-journey-modal .modal-close-button:focus-visible { outline: 3px solid var(--production-teal); outline-offset: 3px; }
.production-order-detail-state { width: 100%; min-height: 52px; box-sizing: border-box; }
.production-order-detail-state .loading-spinner { width: 18px; height: 18px; }
.production-order-detail-summary b { display: block; color: var(--production-ink); font-weight: 900; }
.production-order-material-empty { margin-top: 8px; }
.production-order-detail-modal .modal-table-wrap { max-height: min(480px, 52vh); }
.production-order-journey-modal { width: min(1240px, calc(100vw - 40px)); overflow-x: hidden; }
.production-order-journey-modal .modal-heading { margin-bottom: 10px; }
.production-order-journey-modal .production-order-detail-summary { grid-template-columns: 1.05fr 1.05fr .82fr 1.06fr 1.12fr; gap: 10px; margin-bottom: 10px; }
.production-order-journey-modal .production-order-detail-summary span { padding: 10px 12px; border-radius: 14px; }
.production-journey-visual { margin-top: 10px; }
.production-journey-context { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 7px; padding: 0 3px; color: #53615e; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.production-journey-context strong { color: var(--production-ink); font-size: 11px; font-weight: 950; letter-spacing: .015em; }
.production-journey-context span { white-space: nowrap; }
.production-journey-scroll { overflow: hidden; padding: 12px 14px 14px; border: 1px solid rgba(21, 42, 39, 0.15); border-radius: 12px; background: linear-gradient(180deg, #fbfdfc, #f2f7f4); }
.production-journey-scroll:focus-visible { outline: 3px solid var(--production-teal); outline-offset: 3px; }
.production-journey-canvas { box-sizing: border-box; width: 100%; min-width: 0; padding: 0; }
.production-journey-axis { position: relative; height: 28px; color: #53615e; font-size: 10.5px; font-weight: 850; font-variant-numeric: tabular-nums; }
.production-journey-tick { position: absolute; bottom: 5px; transform: translateX(-50%); white-space: nowrap; }
.production-journey-tick:first-child { transform: none; }
.production-journey-tick:last-child { transform: translateX(-100%); }
.production-journey-track { position: relative; height: 108px; overflow: hidden; border: 1px solid rgba(21, 42, 39, 0.15); border-radius: 10px; background: #edf3f0; }
.production-journey-selected-day { position: absolute; top: 0; bottom: 0; z-index: 0; background: rgba(236, 178, 64, 0.19); box-shadow: inset 0 0 0 1px rgba(157, 102, 0, 0.16); pointer-events: none; }
.production-journey-grid-line { position: absolute; top: 0; bottom: 0; z-index: 1; border-left: 1px solid rgba(21, 42, 39, 0.075); pointer-events: none; }
.production-journey-day-divider { position: absolute; top: 0; bottom: 0; z-index: 1; border-left: 1px dashed rgba(21, 42, 39, 0.34); pointer-events: none; }
.production-journey-bar { position: absolute; z-index: 2; top: 38px; height: 32px; min-width: 8px; border-radius: 7px; background: linear-gradient(90deg, #14594c, #1d6757); box-shadow: 0 5px 12px rgba(23, 107, 91, 0.26); }
.production-journey-track.is-recipe .production-journey-bar { background: linear-gradient(90deg, #9e341f, #b74128); box-shadow: 0 5px 12px rgba(158, 52, 31, 0.26); }
.production-journey-marker { position: absolute; top: -27px; color: #283b38; font-size: 11px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.production-journey-marker::after { position: absolute; top: 18px; width: 2px; height: 42px; background: currentColor; content: ""; opacity: 0.7; }
.production-journey-marker.is-start { left: 0; transform: translateX(-3px); }
.production-journey-marker.is-start::after { left: 3px; }
.production-journey-marker.is-end { right: 0; transform: translateX(3px); }
.production-journey-marker.is-end::after { right: 3px; }
.production-journey-marker.is-start.is-edge-start { transform: none; }
.production-journey-marker.is-start.is-edge-start::after { left: 0; }
.production-journey-marker.is-start.is-edge-end { right: 0; left: auto; transform: none; }
.production-journey-marker.is-start.is-edge-end::after { right: 0; left: auto; }
.production-journey-marker.is-end.is-edge-start { right: auto; left: 0; transform: none; }
.production-journey-marker.is-end.is-edge-start::after { right: auto; left: 0; }
.production-journey-marker.is-end.is-edge-end { transform: none; }
.production-journey-marker.is-end.is-edge-end::after { right: 0; }
.production-journey-bar.has-stacked-markers .production-journey-marker.is-end { top: 40px; transform: translateX(3px); }
.production-journey-bar.has-stacked-markers .production-journey-marker.is-end::after { top: -21px; height: 23px; }

@keyframes production-live-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.72); opacity: 0.68; } }
@keyframes production-reveal { from { transform: translateY(5px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes production-bar-grow { from { transform: scaleX(0.05); opacity: 0.4; } to { transform: scaleX(1); opacity: 1; } }
@keyframes production-refresh { from { transform: translateY(2px); opacity: 0.8; } to { transform: translateY(0); opacity: 1; } }
@keyframes production-loading { 0%, 100% { transform: translateX(0); opacity: 0.55; } 50% { transform: translateX(2px); opacity: 1; } }

@media (min-height: 800px) {
  .production-order-journey-modal { max-height: none; overflow-y: visible; }
}

@media (max-height: 799px), (max-width: 760px) {
  .production-order-journey-modal { max-height: calc(100dvh - 24px); overflow-y: auto; }
}

@media (max-width: 760px) {
  .production-order-journey-modal { width: calc(100vw - 16px); }
  .production-order-journey-modal .production-order-detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-order-journey-modal .production-order-detail-summary span:last-child { grid-column: 1 / -1; }
  .production-journey-context { align-items: flex-start; flex-direction: column; gap: 2px; }
  .production-journey-scroll { padding: 10px 8px 12px; }
  .production-journey-axis { font-size: 10px; }
  .production-journey-track { height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  .production-journey-bar, .production-timeline-bar { animation: none; }
}

@media (max-width: 1180px) {
  .production-machine-groups { max-height: none; }
  .production-order-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .production-monitor-hero { align-items: flex-start; flex-direction: column; gap: 10px; padding: 12px 14px; }
  .production-monitor-status { width: 100%; }
  .production-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-order-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-panel { padding: 16px; }
  .production-panel-heading { flex-direction: column; }
  .production-legend { justify-content: flex-start; }
}

@media (max-width: 700px) {
  .production-time-axis, .production-timeline { min-width: 720px; }
}

@media (max-width: 480px) {
  .production-kpi-strip, .production-order-grid, .production-loading-state { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .tab-strip { scroll-behavior: auto !important; }
  .production-monitor-shell *, .production-monitor-shell *::before, .production-monitor-shell *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Production article coverage */
.production-coverage-card {
  --coverage-billable: #1f6b57;
  --coverage-transfer: #d58a1f;
  --coverage-production: #315ba7;
  --coverage-orders: #171a20;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(31, 107, 87, 0.055), transparent 42%),
    var(--panel);
}

.production-coverage-heading {
  align-items: flex-start;
}

.production-coverage-summary,
.production-coverage-legend,
.production-coverage-values {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.production-coverage-summary {
  justify-content: flex-end;
  gap: 7px;
  padding-right: 0;
}

.production-coverage-summary .metric-chip.is-shortage {
  color: #9d2c1f;
  background: #ffebe6;
}

.production-coverage-summary .metric-chip.is-surplus {
  color: #185c49;
  background: #e3f3ed;
}

.production-coverage-legend {
  gap: 8px 18px;
  margin: 2px 0 18px;
  padding: 11px 13px;
  border: 1px solid rgba(16, 18, 23, 0.08);
  border-radius: 15px;
  color: #4e5562;
  background: rgba(255, 255, 255, 0.56);
  font-size: 0.76rem;
  font-weight: 750;
}

.production-coverage-legend span,
.production-coverage-values span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.production-coverage-legend i,
.production-coverage-values i {
  display: inline-block;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--coverage-billable);
}

.production-coverage-legend i.is-transfer,
.production-coverage-values i.is-transfer {
  background: var(--coverage-transfer);
}

.production-coverage-legend i.is-production,
.production-coverage-values i.is-production {
  background: var(--coverage-production);
}

.production-coverage-legend i.is-orders,
.production-coverage-values .is-orders i {
  width: 3px;
  border-radius: 1px;
  background: var(--coverage-orders);
}

.production-coverage-list {
  display: grid;
  max-height: 720px;
  overflow-y: auto;
  gap: 8px;
  padding: 2px 5px 2px 2px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.production-coverage-list:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
  border-radius: 12px;
}

.production-coverage-row {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(280px, 1fr) minmax(100px, 126px);
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid rgba(16, 18, 23, 0.09);
  border-left: 4px solid #318068;
  border-radius: 16px;
  background: rgba(255, 252, 245, 0.82);
}

.production-coverage-row.is-shortage {
  border-left-color: #b8402d;
}

.production-coverage-row.is-exact {
  border-left-color: #6a717d;
}

.production-coverage-row.is-alert-target {
  border-color: #e79a38;
  border-left-width: 5px;
  box-shadow: 0 0 0 3px rgba(231, 154, 56, 0.22);
  animation: production-alert-target-pulse 1.6s ease-out 1;
}

@keyframes production-alert-target-pulse {
  0% { box-shadow: 0 0 0 7px rgba(231, 154, 56, 0.38); }
  100% { box-shadow: 0 0 0 3px rgba(231, 154, 56, 0.22); }
}


.production-coverage-row.has-negative-quantity {
  background:
    repeating-linear-gradient(135deg, rgba(181, 111, 21, 0.025) 0 8px, transparent 8px 16px),
    rgba(255, 252, 245, 0.88);
}

.production-coverage-identity,
.production-coverage-balance {
  display: grid;
  min-width: 0;
}

.production-coverage-identity {
  gap: 3px;
}

.production-coverage-identity strong {
  color: #172027;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 900;
}

.production-coverage-identity span {
  overflow: hidden;
  color: #626975;
  font-size: 0.76rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-coverage-visual {
  display: grid;
  min-width: 0;
  gap: 9px;
}

.production-coverage-track {
  position: relative;
  display: flex;
  width: 100%;
  height: 24px;
  border: 1px solid rgba(16, 18, 23, 0.10);
  border-radius: 7px;
  background:
    repeating-linear-gradient(90deg, rgba(16, 18, 23, 0.055) 0 1px, transparent 1px 10%),
    #f1eee7;
  box-shadow: inset 0 1px 2px rgba(16, 18, 23, 0.07);
}

.production-coverage-segment {
  display: block;
  width: var(--billable-width);
  min-width: 0;
  height: 100%;
  background: var(--coverage-billable);
}

.production-coverage-segment.is-billable {
  border-radius: 6px 0 0 6px;
}

.production-coverage-segment.is-transfer {
  width: var(--transfer-width);
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.20) 0 3px, transparent 3px 7px),
    var(--coverage-transfer);
}

.production-coverage-segment.is-production {
  width: var(--production-width);
  border-radius: 0 6px 6px 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.17) 0 2px, transparent 2px 6px),
    var(--coverage-production);
}

.production-orders-marker {
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: var(--orders-position);
  z-index: 2;
  width: 3px;
  border-radius: 2px;
  background: var(--coverage-orders);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.78);
  transform: translateX(-50%);
}

.production-orders-marker i {
  position: absolute;
  top: -17px;
  left: 50%;
  color: #30343b;
  font-size: 0.61rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  transform: translateX(-50%);
}

.production-coverage-values {
  gap: 5px 13px;
  color: #626975;
  font-size: 0.69rem;
  line-height: 1.3;
}

.production-coverage-values strong {
  color: #20252c;
  font-variant-numeric: tabular-nums;
}

.production-coverage-adjustment {
  color: #81520e;
  font-size: 0.69rem;
  font-weight: 750;
  line-height: 1.35;
}

.production-coverage-balance {
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.production-coverage-balance span {
  color: #626975;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.production-coverage-balance strong {
  color: #185c49;
  font-size: 1.3rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.production-coverage-balance small {
  color: #626975;
  font-size: 0.68rem;
}

.production-coverage-balance.is-shortage strong {
  color: #a83224;
}

.production-coverage-balance.is-exact strong {
  color: #4d5561;
  font-size: 0.94rem;
  letter-spacing: 0;
}

@media (max-width: 900px) {
  .production-coverage-row {
    grid-template-columns: minmax(125px, 175px) minmax(260px, 1fr) 96px;
    gap: 12px;
  }

  .production-coverage-list {
    overflow-x: auto;
  }
}

@media (max-width: 620px) {
  .production-coverage-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .production-coverage-summary {
    justify-content: flex-start;
    padding-right: 0;
  }

  .production-coverage-legend {
    align-items: flex-start;
    flex-direction: column;
  }

  .production-coverage-list {
    max-height: 620px;
    overflow-x: hidden;
  }

  .production-coverage-row {
    grid-template-columns: 1fr auto;
    gap: 13px 10px;
    padding: 13px;
  }

  .production-coverage-visual {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .production-coverage-balance {
    grid-column: 2;
    grid-row: 1;
  }

  .production-coverage-identity span {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .production-coverage-card *,
  .production-coverage-card *::before,
  .production-coverage-card *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }

  .production-coverage-row.is-alert-target {
    animation: none;
  }
}


/* Production monitor export */
.production-timeline-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  min-width: 0;
  gap: 10px;
  padding-right: 2px;
}
.production-export { position: relative; flex: 0 0 auto; }
.production-export-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(23, 107, 91, 0.24);
  border-radius: 10px;
  color: #14594c;
  background: #f6fcf9;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.production-export-trigger:hover:not(.is-busy) { border-color: rgba(23, 107, 91, 0.52); background: var(--production-teal-soft); }
.production-export-trigger:focus-visible,
.production-export-menu button:focus-visible { outline: 3px solid var(--production-teal); outline-offset: 3px; }
.production-export-trigger.is-busy { cursor: wait; opacity: 0.62; }
.production-export-icon { position: relative; width: 14px; height: 15px; border-bottom: 2px solid currentColor; }
.production-export-icon::before { position: absolute; top: 0; left: 6px; width: 2px; height: 9px; background: currentColor; content: ""; }
.production-export-icon::after { position: absolute; top: 5px; left: 3px; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; content: ""; transform: rotate(45deg); }
.production-export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 12;
  display: grid;
  min-width: 166px;
  padding: 5px;
  border: 1px solid rgba(21, 42, 39, 0.16);
  border-radius: 11px;
  background: #fffdfa;
  box-shadow: 0 12px 25px rgba(21, 42, 39, 0.18);
}
.production-export-menu[hidden] { display: none; }
.production-export-menu button {
  min-height: 40px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  color: #243a36;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.production-export-menu button:hover:not(:disabled) { color: #0f4d40; background: var(--production-teal-soft); }
.production-export-menu button:disabled { cursor: wait; opacity: 0.62; }
.production-export-status-error { color: #a5402d; }
@media (max-width: 760px) {
  .production-timeline-heading-actions { align-items: flex-start; justify-content: space-between; width: 100%; }
  .production-legend { justify-content: flex-start; }
}
.production-export-feedback { max-width: 190px; color: #53615e; font-size: 11px; font-weight: 750; line-height: 1.25; }
.production-export-feedback.is-error { color: #a5402d; }

/* ========================================================================== */
/* Dashboard 2026 refresh — visual language based on the approved mockup      */
/* ========================================================================== */

body.dashboard-theme {
  --ink: #11181c;
  --muted: #6f7772;
  --paper: #eee6d8;
  --panel: #fbf8f1;
  --panel-solid: #fbf8f1;
  --line: #d8d0c3;
  --accent: #f59f2f;
  --accent-dark: #d88410;
  --green: #11181c;
  --blue: #11181c;
  --orange: #f59f2f;
  min-height: 100vh;
  color: var(--ink);
  background: #eee6d8;
}

body.dashboard-theme::before {
  display: none;
}

.dashboard-theme .app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 26px 30px 42px 142px;
}

.dashboard-theme .content-wrap {
  width: min(1540px, 100%);
  min-height: calc(100vh - 52px);
  margin: 0 auto;
}

.dashboard-theme .dashboard-sidebar {
  position: fixed;
  z-index: 1200;
  top: 26px;
  bottom: 26px;
  left: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 92px;
  padding: 16px 10px 14px;
  overflow: hidden;
  border-radius: 30px;
  color: #f9f6ee;
  background: #11181c;
  box-shadow: none;
}

.dashboard-theme .dashboard-sidebar-brand {
  display: grid;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  margin-bottom: 13px;
  place-items: center;
  border-radius: 18px;
  color: #11181c;
  background: #faf7ef;
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.dashboard-theme .dashboard-sidebar .tab-strip {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  scrollbar-width: none;
}

.dashboard-theme .dashboard-sidebar .tab-strip::-webkit-scrollbar {
  display: none;
}

.dashboard-theme .dashboard-sidebar .dashboard-nav-button {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 52px;
  padding: 6px 3px;
  border: 0;
  border-radius: 17px;
  color: rgba(250, 247, 239, 0.80);
  background: transparent;
  box-shadow: none;
  font-size: 0.56rem;
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: 0;
  text-align: center;
  white-space: normal;
}

.dashboard-theme .dashboard-sidebar .dashboard-nav-button .ui-icon {
  width: 18px;
  height: 18px;
  color: currentColor;
}

.dashboard-theme .dashboard-sidebar .dashboard-nav-button > span:last-child {
  display: block;
  max-width: 68px;
}

.dashboard-theme .dashboard-sidebar .dashboard-nav-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.dashboard-theme .dashboard-sidebar .dashboard-nav-button.is-active {
  color: #11181c;
  background: #faf7ef;
  box-shadow: none;
}

.dashboard-theme .dashboard-sidebar .dashboard-nav-monitor-ventas {
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0 0 17px 17px;
}

.dashboard-theme .dashboard-sidebar-foot {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-top: 8px;
  padding: 10px 3px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.20);
  color: rgba(250, 247, 239, 0.82);
  font-size: 0.57rem;
  font-weight: 800;
}

.dashboard-theme .dashboard-sidebar-foot .ui-icon {
  width: 17px;
  height: 17px;
}

.dashboard-theme .dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 28px;
  row-gap: 0;
  min-height: 118px;
  margin: 0 0 12px;
  padding: 20px 24px;
  overflow: hidden;
  border: 0;
  border-radius: 0 26px 26px 0;
  color: #fff;
  background: linear-gradient(90deg, #11181c 0%, #11181c 76%, #d88410 76%, #f59f2f 100%);
  box-shadow: none;
  backdrop-filter: none;
}

.dashboard-theme .dashboard-hero::before,
.dashboard-theme .dashboard-hero::after {
  display: none;
}

.dashboard-theme .hero-topline {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 18px;
  display: flex;
  grid-column: auto;
  margin: 0;
}

.dashboard-theme .hero-user-pill,
.dashboard-theme .hero-logout-button {
  min-height: 28px;
  padding: 5px 10px;
  border-color: rgba(255,255,255,.18);
  font-size: .69rem;
}

.dashboard-theme .hero-copy {
  align-self: center;
}

.dashboard-theme .dashboard-hero .eyebrow {
  margin: 0 0 7px;
  color: #f7b457;
  font-size: .62rem;
  letter-spacing: .09em;
}

.dashboard-theme .dashboard-hero h1 {
  margin: 0;
  max-width: none;
  color: #fff;
  font-family: Manrope, Verdana, sans-serif;
  font-size: clamp(1.9rem, 3vw, 2.65rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.055em;
}

.dashboard-theme .dashboard-hero .hero-text {
  margin: 7px 0 0;
  max-width: 650px;
  color: rgba(255,255,255,.72);
  font-size: .78rem;
  font-weight: 600;
}

.dashboard-theme .hero-context {
  margin-top: 7px;
}

.dashboard-theme .hero-context span {
  min-height: 0;
  padding: 0;
  border: 0;
  color: rgba(255,255,255,.58);
  background: transparent;
  box-shadow: none;
  font-size: .68rem;
}

.dashboard-theme .hero-context strong {
  font-size: .56rem;
}

.dashboard-theme .dashboard-period-panel {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  align-content: center;
  gap: 9px;
  min-width: 250px;
  min-height: 72px;
  margin-top: 18px;
}

.dashboard-theme .period-chip,
.dashboard-theme .period-filter-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 15px;
  border: 0;
  border-radius: 999px;
  color: #11181c;
  background: #fff;
  font-size: .72rem;
  font-weight: 900;
  text-decoration: none;
}

.dashboard-theme .period-filter-link {
  grid-column: 2;
  color: #fff;
  background: #11181c;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}

.dashboard-theme .filter-panel {
  display: block;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.dashboard-theme .filter-drawer {
  display: block;
  width: 100%;
}

.dashboard-theme .filter-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 58px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #faf7f0;
  box-shadow: none;
}

.dashboard-theme .filter-summary-heading {
  min-width: 105px;
}

.dashboard-theme .filter-summary-heading strong {
  display: none;
}

.dashboard-theme .filter-summary-heading .eyebrow {
  margin: 0;
  color: #f59f2f;
  font-size: .62rem;
  white-space: nowrap;
}

.dashboard-theme .filter-summary-chips {
  flex-wrap: nowrap;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dashboard-theme .filter-summary-chips::-webkit-scrollbar {
  display: none;
}

.dashboard-theme .filter-summary-chips span {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 10px;
  border-color: #d9d2c7;
  color: #2a3338;
  background: #fff;
  font-size: .67rem;
}

.dashboard-theme .filter-summary-chips span strong {
  color: #1a2328;
}

.dashboard-theme .filter-toggle-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 32px;
  padding: 5px 13px;
  border-radius: 999px;
  color: #fff;
  background: #11181c;
  font-size: .62rem;
  font-weight: 900;
}

.dashboard-theme .filter-toggle-text::after {
  margin-left: 7px;
  content: "↑";
}

.dashboard-theme .filter-drawer[open] .filter-toggle-text::after {
  content: "↓";
}

.dashboard-theme .filter-body {
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #faf7f0;
}

.dashboard-theme .widget-aggregator {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(250,247,240,.72);
  box-shadow: none;
  backdrop-filter: none;
}

.dashboard-theme .widget-aggregator-copy {
  min-width: 150px;
}

.dashboard-theme .widget-aggregator-copy .eyebrow,
.dashboard-theme .widget-aggregator-copy p {
  display: none;
}

.dashboard-theme .widget-aggregator-copy h2 {
  margin: 0;
  font-size: .78rem;
  font-weight: 900;
}

.dashboard-theme .widget-aggregator-controls {
  flex: 1 1 auto;
}

.dashboard-theme .widget-aggregator-controls > label,
.dashboard-theme .widget-aggregator-meta {
  display: none;
}

.dashboard-theme .widget-aggregator-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-theme .widget-aggregator-actions select,
.dashboard-theme .widget-aggregator-actions button {
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: .68rem;
}

.dashboard-theme .kpi-card,
.dashboard-theme .chart-card,
.dashboard-theme .sales-monitor-panel,
.dashboard-theme .sales-monitor-empty,
.dashboard-theme .sales-monitor-kpi {
  border-color: var(--line);
  background: #fbf8f1;
  box-shadow: none;
  backdrop-filter: none;
}

.dashboard-theme .kpi-card {
  min-height: 132px;
  padding: 18px;
  border-radius: 18px;
}

.dashboard-theme .kpi-main {
  color: #fff;
  background: #11181c;
}

.dashboard-theme .chart-card {
  padding: 18px;
  border-radius: 20px;
}

.dashboard-theme .dashboard-grid,
.dashboard-theme .kpi-grid {
  gap: 14px;
}

.dashboard-theme .card-heading h2 {
  color: #11181c;
  font-family: Manrope, Verdana, sans-serif;
  font-weight: 900;
  letter-spacing: -0.045em;
}

.dashboard-theme .metric-chip,
.dashboard-theme .ghost-button {
  box-shadow: none;
}

.dashboard-theme .sales-section-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: 0 0 14px;
  padding: 7px 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #faf7f0;
  scrollbar-width: none;
}

.dashboard-theme .sales-section-tabs::-webkit-scrollbar {
  display: none;
}

.dashboard-theme .sales-section-tabs a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 35px;
  padding: 7px 20px;
  border-radius: 999px;
  color: #5a625e;
  font-size: .73rem;
  font-weight: 850;
  text-decoration: none;
}

.dashboard-theme .sales-section-tabs a:hover,
.dashboard-theme .sales-section-tabs a.is-active {
  color: #fff;
  background: #11181c;
}

.dashboard-theme .sales-section-tabs > span {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0 10px;
  color: #8a8d89;
  font-size: .66rem;
  white-space: nowrap;
}

.dashboard-theme .sales-overview {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  scroll-margin-top: 20px;
}

.dashboard-theme .sales-overview-warning {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 13px;
  border: 1px solid #e6c4b8;
  border-radius: 14px;
  color: #8f3f2c;
  background: #fff2ed;
  font-size: .7rem;
}

.dashboard-theme .sales-overview-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-theme .sales-overview-kpi {
  min-width: 0;
  min-height: 112px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbf8f1;
}

.dashboard-theme .sales-overview-kpi.is-primary {
  color: #fff;
  border-color: #11181c;
  background: #11181c;
}

.dashboard-theme .sales-overview-kpi > span,
.dashboard-theme .sales-overview-kpi > small {
  display: block;
  overflow: hidden;
  color: #7b817d;
  font-size: .61rem;
  font-weight: 850;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: .025em;
  white-space: nowrap;
}

.dashboard-theme .sales-overview-kpi.is-primary > span,
.dashboard-theme .sales-overview-kpi.is-primary > small {
  color: rgba(255,255,255,.75);
}

.dashboard-theme .sales-overview-kpi > strong {
  display: block;
  margin: 12px 0 7px;
  color: #102a22;
  font-size: clamp(1.55rem, 2.25vw, 2.05rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.055em;
  white-space: nowrap;
}

.dashboard-theme .sales-overview-kpi.is-primary > strong {
  color: #fff;
}

.dashboard-theme .sales-overview-progress {
  height: 5px;
  margin: 0 0 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e1d8;
}

.dashboard-theme .sales-overview-progress i {
  display: block;
  width: var(--sales-progress);
  height: 100%;
  border-radius: inherit;
  background: #11181c;
}

.dashboard-theme .sales-overview-main-grid,
.dashboard-theme .sales-overview-bottom-grid {
  display: grid;
  gap: 14px;
}

.dashboard-theme .sales-overview-main-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .85fr);
}

.dashboard-theme .sales-overview-bottom-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-theme .sales-overview-card {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbf8f1;
}

.dashboard-theme .sales-overview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard-theme .sales-overview-heading .eyebrow {
  color: #f59f2f;
  font-size: .56rem;
}

.dashboard-theme .sales-overview-heading h2 {
  margin: 4px 0 0;
  color: #11181c;
  font-size: clamp(1.05rem, 1.55vw, 1.38rem);
  font-weight: 950;
  letter-spacing: -0.04em;
}

.dashboard-theme .sales-overview-heading p {
  margin: 3px 0 0;
  color: #7f8581;
  font-size: .64rem;
}

.dashboard-theme .sales-overview-heading > a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #1a2328;
  background: #fff;
  font-size: .65rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.dashboard-theme .sales-overview-bars {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.dashboard-theme .sales-overview-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(140px, 2fr) auto;
  gap: 10px;
  align-items: center;
}

.dashboard-theme .sales-bar-label {
  display: flex;
  min-width: 0;
  gap: 5px;
  color: #607069;
  font-size: .68rem;
  white-space: nowrap;
}

.dashboard-theme .sales-bar-label b,
.dashboard-theme .sales-bar-label em {
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: normal;
}

.dashboard-theme .sales-bar-track {
  display: block;
  height: 15px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e3dc;
}

.dashboard-theme .sales-bar-track i {
  display: block;
  width: var(--sales-bar);
  height: 100%;
  border-radius: inherit;
  background: #11181c;
}

.dashboard-theme .sales-overview-bar-row > strong {
  display: inline-flex;
  min-width: 94px;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  color: #5d6964;
  font-size: .66rem;
  text-align: right;
  white-space: nowrap;
}

.dashboard-theme .sales-overview-bar-row > strong small {
  color: #d88410;
  font-size: .58rem;
  font-weight: 950;
}

.dashboard-theme .sales-action-list {
  display: grid;
  gap: 7px;
}

.dashboard-theme .sales-action-list a {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid #ddd5ca;
  border-radius: 13px;
  color: #394940;
  background: #fff;
  text-decoration: none;
}

.dashboard-theme .sales-action-list a > b {
  display: grid;
  width: 32px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: #11181c;
  font-size: .7rem;
}

.dashboard-theme .sales-action-list a > b.is-alert {
  background: #c74934;
}

.dashboard-theme .sales-action-list a > b.is-warning {
  background: #c8822b;
}

.dashboard-theme .sales-action-list a > span {
  display: grid;
  gap: 1px;
}

.dashboard-theme .sales-action-list strong {
  font-size: .61rem;
  text-transform: uppercase;
}

.dashboard-theme .sales-action-list small {
  color: #818681;
  font-size: .63rem;
}

.dashboard-theme .sales-client-bars,
.dashboard-theme .sales-margin-mini-list {
  display: grid;
  gap: 9px;
}

.dashboard-theme .sales-client-bars > div,
.dashboard-theme .sales-margin-mini-list > div {
  display: grid;
  grid-template-columns: minmax(80px, .55fr) minmax(140px, 1.7fr) auto;
  gap: 10px;
  align-items: center;
  color: #607069;
  font-size: .65rem;
}

.dashboard-theme .sales-client-bars i,
.dashboard-theme .sales-margin-mini-list i {
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e2da;
}

.dashboard-theme .sales-client-bars i b,
.dashboard-theme .sales-margin-mini-list i b {
  display: block;
  width: var(--sales-bar);
  height: 100%;
  border-radius: inherit;
  background: #11181c;
}

.dashboard-theme .sales-client-bars strong,
.dashboard-theme .sales-margin-mini-list strong {
  min-width: 68px;
  font-size: .62rem;
  text-align: right;
}

.dashboard-theme .sales-margin-value {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: -4px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd5ca;
}

.dashboard-theme .sales-margin-value span {
  color: #7d827f;
  font-size: .62rem;
  font-weight: 800;
}

.dashboard-theme .sales-margin-value strong {
  color: #11181c;
  font-size: 1.05rem;
  font-weight: 950;
}

.dashboard-theme .sales-overview-empty {
  min-height: 100px;
  display: grid;
  place-items: center;
  color: #858985;
  font-size: .72rem;
}

.dashboard-theme .sales-detail-grid {
  margin-top: 18px;
  scroll-margin-top: 14px;
}

.dashboard-theme .sales-anchor-card {
  scroll-margin-top: 14px;
}

.dashboard-theme .sales-monitor-kpi,
.dashboard-theme .sales-monitor-panel,
.dashboard-theme .sales-monitor-empty {
  border-radius: 18px;
}

@media (max-width: 1100px) {
  .dashboard-theme .sales-overview-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .sales-overview-main-grid,
  .dashboard-theme .sales-overview-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .dashboard-theme .app-shell {
    padding: 14px 14px 34px;
  }

  .dashboard-theme .content-wrap {
    min-height: calc(100vh - 28px);
  }

  .dashboard-theme .dashboard-sidebar {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
    height: auto;
    margin: 0 0 10px;
    padding: 8px;
    overflow: visible;
    border-radius: 20px;
  }

  .dashboard-theme .dashboard-sidebar-brand {
    width: 46px;
    height: 46px;
    margin: 0 8px 0 0;
    border-radius: 14px;
  }

  .dashboard-theme .dashboard-sidebar .tab-strip {
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button {
    width: 72px;
    min-height: 46px;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-monitor-ventas {
    margin-top: 0;
    border-top: 0;
    border-radius: 17px;
  }

  .dashboard-theme .dashboard-sidebar-foot {
    display: none;
  }

  .dashboard-theme .filter-panel {
    display: block;
  }

  .dashboard-theme .dashboard-hero {
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .dashboard-theme .dashboard-period-panel {
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    min-width: 0;
    min-height: 0;
    margin-top: 12px;
  }

  .dashboard-theme .period-filter-link {
    grid-column: auto;
  }

  .dashboard-theme .hero-topline {
    top: 10px;
    right: 12px;
  }
}

@media (max-width: 680px) {
  .dashboard-theme .dashboard-hero {
    padding: 18px;
  }

  .dashboard-theme .dashboard-period-panel {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-theme .period-filter-link {
    grid-column: 1 / -1;
  }

  .dashboard-theme .filter-summary {
    grid-template-columns: 1fr auto;
  }

  .dashboard-theme .filter-summary-heading {
    min-width: 0;
  }

  .dashboard-theme .filter-summary-chips {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .dashboard-theme .widget-aggregator {
    display: block;
  }

  .dashboard-theme .widget-aggregator-copy {
    margin-bottom: 7px;
  }

  .dashboard-theme .widget-aggregator-actions {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .dashboard-theme .sales-overview-kpis {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .sales-section-tabs > span {
    display: none;
  }

  .dashboard-theme .sales-overview-bar-row {
    grid-template-columns: 105px minmax(100px, 1fr) auto;
  }

  .dashboard-theme .sales-client-bars > div,
  .dashboard-theme .sales-margin-mini-list > div {
    grid-template-columns: 82px minmax(90px, 1fr) auto;
  }
}

@media (max-height: 760px) and (min-width: 901px) {
  .dashboard-theme .dashboard-sidebar {
    top: 14px;
    bottom: 14px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .dashboard-theme .dashboard-sidebar-brand {
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button {
    min-height: 44px;
    font-size: .50rem;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button .ui-icon {
    width: 15px;
    height: 15px;
  }
}

/* ========================================================================== */
/* LIVS dashboard refinement v2 — compact header + collapsible grouped rail  */
/* ========================================================================== */

body.dashboard-theme {
  --sidebar-compact-width: 82px;
  --sidebar-expanded-width: 232px;
  --sidebar-left: 26px;
  --sidebar-gap: 26px;
}

.dashboard-theme .dashboard-hero {
  min-height: 92px;
  margin-bottom: 10px;
  padding: 14px 18px;
  border-radius: 20px;
  background: linear-gradient(120deg, #11181c 0%, #151d22 58%, #1a2328 100%);
}

.dashboard-theme .dashboard-hero .eyebrow {
  margin-bottom: 5px;
  color: #f7b457;
  font-size: .56rem;
}

.dashboard-theme .dashboard-hero h1 {
  font-size: clamp(1.7rem, 2.35vw, 2.2rem);
}

.dashboard-theme .dashboard-hero .hero-text {
  margin-top: 5px;
  font-size: .72rem;
}

.dashboard-theme .hero-context {
  margin-top: 5px;
}

.dashboard-theme .hero-context span {
  font-size: .57rem;
}

.dashboard-theme .hero-topline {
  top: 9px;
  right: 13px;
}

.dashboard-theme .hero-user-pill,
.dashboard-theme .hero-logout-button {
  min-height: 25px;
  padding: 4px 9px;
  font-size: .63rem;
}

.dashboard-theme .dashboard-period-panel {
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 7px;
  min-width: 205px;
  min-height: 40px;
  margin-top: 15px;
}

.dashboard-theme .period-chip {
  min-height: 28px;
  padding: 4px 12px;
  font-size: .67rem;
  background: rgba(255, 255, 255, .96);
}

.dashboard-theme .period-filter-link {
  display: none !important;
}

.dashboard-theme .filter-summary {
  min-height: 52px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.dashboard-theme .dashboard-sidebar {
  overflow: visible;
  transition: width 180ms ease, border-radius 180ms ease, box-shadow 180ms ease;
}

.dashboard-theme .dashboard-sidebar-header {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.dashboard-theme .dashboard-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 58px;
  height: 48px;
  margin: 0 0 12px;
  padding: 5px 4px;
  border-radius: 16px;
  overflow: hidden;
  transition: width 180ms ease, justify-content 180ms ease, gap 180ms ease, padding 180ms ease;
}

.dashboard-theme .dashboard-brand-mark,
.dashboard-theme .dashboard-brand-name {
  display: block;
  line-height: 1;
}

.dashboard-theme .dashboard-brand-mark {
  width: 0;
  overflow: hidden;
  opacity: 0;
  color: #11181c;
  font-size: .78rem;
  font-weight: 950;
  transition: width 160ms ease, opacity 160ms ease;
}

.dashboard-theme .dashboard-brand-name {
  color: #11181c;
  font-size: .69rem;
  font-weight: 950;
  letter-spacing: .08em;
}

.dashboard-theme .dashboard-sidebar-toggle {
  position: absolute;
  z-index: 5;
  top: 15px;
  right: -23px;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid #d8d0c3;
  border-radius: 999px;
  color: #11181c;
  background: #fbf8f1;
  box-shadow: 0 5px 18px rgba(17, 24, 28, .16);
  cursor: pointer;
}

.dashboard-theme .dashboard-sidebar-toggle:hover {
  background: #fff;
}

.dashboard-theme .dashboard-sidebar-toggle span {
  display: block;
  margin-top: -1px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.dashboard-theme .dashboard-sidebar .tab-strip {
  gap: 0;
}

.dashboard-theme .dashboard-nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.dashboard-theme .dashboard-nav-section + .dashboard-nav-section {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, .18);
}

.dashboard-theme .dashboard-nav-section-title {
  display: block;
  padding: 1px 3px 3px;
  color: rgba(250, 247, 239, .48);
  font-size: .49rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .055em;
  white-space: nowrap;
}

.dashboard-theme .dashboard-sidebar .dashboard-nav-monitor-ventas {
  margin-top: 0;
  border-top: 0;
  border-radius: 17px;
}

@media (min-width: 901px) {
  .dashboard-theme .app-shell {
    padding-left: calc(var(--sidebar-left) + var(--sidebar-compact-width) + var(--sidebar-gap));
    transition: padding-left 180ms ease;
  }

  .dashboard-theme.sidebar-expanded .app-shell {
    padding-left: calc(var(--sidebar-left) + var(--sidebar-expanded-width) + var(--sidebar-gap));
  }

  .dashboard-theme .dashboard-sidebar {
    left: var(--sidebar-left);
    width: var(--sidebar-compact-width);
    padding-right: 9px;
    padding-left: 9px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar {
    width: var(--sidebar-expanded-width);
    align-items: stretch;
    padding-right: 12px;
    padding-left: 12px;
    border-radius: 26px;
    box-shadow: 0 12px 34px rgba(13, 48, 39, .13);
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-header {
    justify-content: flex-start;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-brand {
    justify-content: flex-start;
    gap: 9px;
    width: 100%;
    padding-right: 12px;
    padding-left: 10px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-brand-mark {
    display: grid;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    place-items: center;
    border-radius: 9px;
    color: #faf7ef;
    background: #11181c;
    opacity: 1;
  }

  .dashboard-theme.sidebar-expanded .dashboard-brand-name {
    font-size: .84rem;
    letter-spacing: .1em;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-section-title {
    padding: 3px 10px 5px;
    font-size: .54rem;
    text-align: left;
    letter-spacing: .09em;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button {
    min-height: 43px;
    padding: 6px 3px;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button > span:last-child {
    display: none;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    min-height: 42px;
    padding: 7px 11px;
    border-radius: 13px;
    font-size: .66rem;
    line-height: 1.15;
    text-align: left;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button .ui-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button > span:last-child {
    display: block;
    max-width: none;
  }

  .dashboard-theme .dashboard-sidebar-foot > span:last-child {
    display: none;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 11px 2px;
    font-size: .63rem;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot > span:last-child {
    display: block;
  }
}

@media (max-width: 900px) {
  .dashboard-theme .app-shell,
  .dashboard-theme.sidebar-expanded .app-shell {
    padding: 14px 14px 34px;
  }

  .dashboard-theme .dashboard-sidebar,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
    height: auto;
    margin: 0 0 10px;
    padding: 8px;
    overflow: visible;
    border-radius: 20px;
  }

  .dashboard-theme .dashboard-sidebar-header {
    width: auto;
  }

  .dashboard-theme .dashboard-sidebar-toggle {
    display: none;
  }

  .dashboard-theme .dashboard-sidebar-brand,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-brand {
    width: 52px;
    height: 46px;
    margin: 0 8px 0 0;
    padding: 5px;
  }

  .dashboard-theme .dashboard-brand-mark {
    display: none;
  }

  .dashboard-theme .dashboard-sidebar .tab-strip {
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .dashboard-theme .dashboard-nav-section,
  .dashboard-theme.sidebar-expanded .dashboard-nav-section {
    display: contents;
  }

  .dashboard-theme .dashboard-nav-section-title {
    display: none;
  }

  .dashboard-theme .dashboard-nav-section + .dashboard-nav-section {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: 72px;
    min-height: 46px;
    padding: 5px 3px;
    font-size: .52rem;
    text-align: center;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button > span:last-child,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button > span:last-child {
    display: block;
    max-width: 66px;
  }

  .dashboard-theme .dashboard-hero {
    min-height: 0;
    padding: 14px 16px;
    border-radius: 18px;
  }

  .dashboard-theme .dashboard-period-panel {
    margin-top: 9px;
  }
}


/* ========================================================================== */
/* Sales refinement v3 — tabbed content, compact previews and single-source   */
/* widgets. The compact card itself expands; no duplicate graph remains.      */
/* ========================================================================== */

.dashboard-theme .dashboard-hero {
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-theme .dashboard-hero .hero-copy {
  padding-right: 110px;
}

.dashboard-theme .sales-section-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  margin: 0 0 10px;
  padding: 5px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(251, 248, 241, .88);
}

.dashboard-theme .sales-section-tabs .sales-section-tab,
.dashboard-theme .sales-section-tabs .sales-section-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin: 0;
  padding: 7px 18px;
  border: 0;
  border-radius: 999px;
  color: #53615c;
  background: transparent;
  box-shadow: none;
  font-family: inherit;
  font-size: .68rem;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.dashboard-theme .sales-section-tabs .sales-section-tab:hover,
.dashboard-theme .sales-section-tabs .sales-section-link:hover {
  color: #11181c;
  background: rgba(17, 24, 28, .06);
}

.dashboard-theme .sales-section-tabs .sales-section-tab.is-active {
  color: #fff;
  background: #11181c;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

.dashboard-theme .sales-section-tabs > span {
  margin-left: auto;
  padding-right: 5px;
  color: #8a8f8a;
  font-size: .58rem;
  font-weight: 650;
  white-space: nowrap;
}

.dashboard-theme .sales-page-warning {
  margin: 0 0 8px;
}

.dashboard-theme .sales-fixed-kpis {
  margin: 0 0 10px;
}

.dashboard-theme .sales-tabbed-shell {
  min-height: 0;
}

.dashboard-theme .sales-section-panel {
  display: none;
}

.dashboard-theme .sales-section-panel.is-active {
  display: block;
  animation: sales-panel-in 140ms ease-out;
}

@keyframes sales-panel-in {
  from { opacity: .35; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.dashboard-theme .sales-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.dashboard-theme .sales-products-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, .85fr);
}

.dashboard-theme .sales-compact-widget {
  position: relative;
  min-width: 0;
  min-height: 278px;
  max-height: 278px;
  margin: 0;
  padding: 14px 16px 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: none;
}

.dashboard-theme .sales-compact-widget > .card-heading {
  min-height: 58px;
  margin: 0 0 8px;
  padding: 0 86px 0 0;
}

.dashboard-theme .sales-compact-widget .sales-overview-heading > div:first-child {
  min-width: 0;
}

.dashboard-theme .sales-compact-widget .sales-overview-heading h2 {
  margin-top: 3px;
  font-size: 1.12rem;
}

.dashboard-theme .sales-compact-widget .sales-overview-heading p {
  max-width: 680px;
  margin-top: 3px;
  font-size: .60rem;
  line-height: 1.35;
}

.dashboard-theme .sales-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-theme .sales-detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #d4ccc0;
  border-radius: 999px;
  color: #173a31;
  background: #fffdf8;
  font-family: inherit;
  font-size: .61rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.dashboard-theme .sales-detail-button:hover {
  border-color: #bdb2a3;
  background: #fff;
}

.dashboard-theme .sales-compact-widget .widget-control-group {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
}

.dashboard-theme .sales-compact-widget .sales-detail-button {
  margin-right: 0;
}

.dashboard-theme .sales-compact-widget.has-widget-controls .sales-overview-heading .sales-detail-button,
.dashboard-theme .sales-compact-widget.has-widget-controls .sales-card-actions {
  margin-right: 62px;
}

.dashboard-theme .sales-widget-preview {
  min-height: 0;
}

.dashboard-theme .sales-widget-detail {
  display: none;
}

.dashboard-theme .sales-top-products-widget .sales-overview-bars {
  gap: 7px;
  margin-top: 4px;
}

.dashboard-theme .sales-top-products-widget .sales-overview-bar-row {
  grid-template-columns: minmax(150px, 225px) minmax(160px, 1fr) auto;
  gap: 9px;
}

.dashboard-theme .sales-top-products-widget .sales-bar-label {
  font-size: .61rem;
}

.dashboard-theme .sales-top-products-widget .sales-overview-bar-row > strong {
  font-size: .62rem;
}

.dashboard-theme .sales-return-widget .return-bars {
  max-height: 184px;
  overflow: hidden;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-row:nth-of-type(n+6) {
  display: none;
}

.dashboard-theme .sales-return-widget .compact-return-row {
  min-height: 31px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.dashboard-theme .sales-return-widget .card-heading {
  padding-right: 82px;
}

.dashboard-theme .sales-client-bars,
.dashboard-theme .sales-margin-mini-list {
  margin-top: 7px;
}

.dashboard-theme .sales-clients-widget .sales-widget-preview,
.dashboard-theme .sales-profitability-widget .sales-widget-preview {
  max-width: 920px;
}

.dashboard-theme .sales-margin-value {
  margin-bottom: 10px;
}

.dashboard-theme .sales-expanded-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 12px;
  padding: 0 2px;
}

.dashboard-theme .sales-expanded-heading h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: -.025em;
}

.dashboard-theme .sales-expanded-heading p {
  max-width: 820px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .69rem;
}

.dashboard-theme .sales-expanded-chart {
  min-height: 320px;
  margin-bottom: 14px;
}

.dashboard-theme .sales-expanded-table {
  max-height: 40vh;
}

.dashboard-theme .sales-expanded-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.dashboard-theme .sales-expanded-tables .ranking-table-wrap {
  max-height: 36vh;
}

.dashboard-theme .sales-compact-widget.is-widget-maximized {
  max-height: none;
}

.dashboard-theme .sales-compact-widget.is-widget-maximized > .card-heading {
  min-height: auto;
  margin-bottom: 10px;
  padding-right: 118px;
}

.dashboard-theme .sales-compact-widget.is-widget-maximized .sales-detail-button,
.dashboard-theme .sales-compact-widget.is-widget-maximized .sales-card-actions .metric-chip {
  display: none;
}

.dashboard-theme .sales-compact-widget.is-widget-maximized .sales-widget-preview {
  display: none;
}

.dashboard-theme .sales-compact-widget.is-widget-maximized .sales-widget-detail {
  display: block;
  min-height: 0;
}

.dashboard-theme .sales-return-widget.is-widget-maximized .return-bars {
  max-height: none;
  overflow: visible;
}

.dashboard-theme .sales-return-widget.is-widget-maximized .return-bar-row {
  display: grid;
}

.dashboard-theme .sales-profitability-widget.is-widget-maximized .sales-widget-detail {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.dashboard-theme .sales-profitability-widget.is-widget-maximized .sales-expanded-table {
  flex: 1 1 auto;
  max-height: none;
}

@media (min-width: 901px) and (min-height: 760px) {
  body.dashboard-theme:has(.sales-tabbed-shell):not(.widget-maximized) {
    overflow: hidden;
  }

  .dashboard-theme .app-shell:has(.sales-tabbed-shell) {
    height: 100vh;
    height: 100dvh;
    padding-top: 18px;
    padding-bottom: 18px;
    overflow: hidden;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) {
    min-height: 0;
    height: calc(100vh - 36px);
    height: calc(100dvh - 36px);
    overflow: hidden;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .dashboard-hero {
    min-height: 84px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .widget-aggregator {
    margin-bottom: 8px;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-tabbed-shell {
    height: min(278px, calc(100dvh - 606px));
    min-height: 218px;
    overflow: hidden;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-section-panel,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-panel-grid,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-compact-widget {
    height: 100%;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-compact-widget {
    min-height: 0;
    max-height: none;
  }
}

@media (max-width: 1120px) {
  .dashboard-theme .sales-products-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .sales-return-widget {
    display: none;
  }
}

@media (max-width: 900px), (max-height: 759px) {
  body.dashboard-theme:has(.sales-tabbed-shell) {
    overflow: auto;
  }

  .dashboard-theme .sales-section-tabs {
    overflow-x: auto;
  }

  .dashboard-theme .sales-section-tabs > span {
    display: none;
  }

  .dashboard-theme .sales-products-grid,
  .dashboard-theme .sales-expanded-tables {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .sales-compact-widget {
    min-height: 300px;
    max-height: none;
  }

  .dashboard-theme .sales-section-panel.is-active {
    display: block;
  }

  .dashboard-theme .sales-return-widget {
    display: block;
  }
}

/* ========================================================================== */
/* Sales refinement v4 — stable tab viewport + corrected maximized widgets    */
/* ========================================================================== */

/* A maximized widget must cover the fixed navigation rail as well. The rail
   normally uses z-index 1200, while generic widgets use 70. Lower the rail
   only for the duration of the maximized state so nested modals keep their
   existing stacking behavior. */
body.dashboard-theme.widget-maximized .dashboard-sidebar {
  z-index: 60;
}

/* The products panel is intentionally a two-card row on desktop. The returns
   widget used to inherit .wide-card (grid-column: 1 / -1), which created a
   second implicit row and forced both cards to share the panel height. */
.dashboard-theme .sales-products-grid > .sales-return-widget {
  grid-column: auto;
}

@media (min-width: 1121px) and (min-height: 760px) {
  /* Use the real remaining viewport instead of a hard-coded height. This keeps
     the page itself fixed while the selected sales tab consumes all remaining
     space. */
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 36px);
    min-height: 0;
    overflow: hidden;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) > .dashboard-hero,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) > .filter-panel,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) > .widget-aggregator,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) > .sales-section-tabs,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) > .sales-page-warning,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) > .sales-fixed-kpis,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) > [data-sales-preparation] {
    flex: 0 0 auto;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-tabbed-shell {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 250px;
    overflow: hidden;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-section-panel.is-active,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-panel-grid {
    height: 100%;
    min-height: 0;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-compact-widget {
    height: 100%;
    min-height: 0;
    max-height: none;
  }

  .dashboard-theme .sales-products-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(360px, .85fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .dashboard-theme .sales-top-products-widget .sales-overview-bars {
    height: calc(100% - 4px);
    align-content: start;
  }

  .dashboard-theme .sales-return-widget .return-bars {
    max-height: none;
    height: calc(100% - 70px);
    overflow: hidden;
  }

  /* When filters are opened they can legitimately need more height. Keep the
     selected tab internally scrollable rather than clipping its cards. */
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell):has(.filter-drawer[open]) {
    overflow-y: auto;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell):has(.filter-drawer[open]) .sales-tabbed-shell {
    flex: 0 0 320px;
    min-height: 320px;
  }
}

/* Full-screen sales widget: keep the dialog inside one viewport. */
.dashboard-theme .sales-compact-widget.is-widget-maximized {
  overflow: hidden !important;
}

.dashboard-theme .sales-compact-widget.is-widget-maximized .sales-widget-detail {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Product ranking uses the full-screen space more efficiently: chart and
   sortable table are shown side-by-side instead of pushing the table below the
   fold. */
@media (min-width: 1000px) and (min-height: 700px) {
  .dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-widget-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(390px, .72fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px 16px;
    align-items: stretch;
  }

  .dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-heading {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-bottom: 0;
  }

  .dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-chart {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    max-height: none;
    height: 100% !important;
    margin: 0;
    overflow: auto;
  }

  .dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-table {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    max-height: none;
    height: 100%;
    margin: 0;
    overflow: auto;
  }

  .dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-chart canvas {
    max-width: 100%;
  }
}

@media (max-width: 1120px) {
  .dashboard-theme .sales-products-grid > .sales-return-widget {
    grid-column: 1;
  }
}


/* ========================================================================== */
/* Sales refinement v5 — compact cards + single maximize action               */
/* ========================================================================== */

/* The generic widget maximize control is now the only detail action. */
.dashboard-theme .sales-compact-widget .sales-detail-button {
  display: none !important;
}

/* Keep the sales tab as the page-sized workspace, but do not stretch each
   summary card to consume all remaining vertical space. */
@media (min-width: 1121px) and (min-height: 760px) {
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-section-panel.is-active,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-panel-grid {
    height: 100%;
    min-height: 0;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-panel-grid {
    align-content: start;
    align-items: start;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-compact-widget {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-products-grid > .sales-compact-widget {
    height: 255px;
    min-height: 255px;
    max-height: 255px;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-panel-grid:not(.sales-products-grid) > .sales-compact-widget {
    height: 255px;
    min-height: 255px;
    max-height: 255px;
  }
}

/* Denser summary cards: these are previews, not the complete reports. */
.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) {
  padding: 11px 14px 12px;
  border-radius: 18px;
}

.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) > .card-heading {
  min-height: 46px;
  margin-bottom: 5px;
  padding-right: 76px;
}

.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) .sales-overview-heading h2,
.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) > .card-heading h2 {
  margin-top: 2px;
  font-size: .98rem;
  line-height: 1.12;
}

.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) .sales-overview-heading p,
.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) > .card-heading p {
  margin-top: 2px;
  font-size: .56rem;
  line-height: 1.25;
}

.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) .widget-control-group {
  top: 9px;
  right: 9px;
}

/* Top articles preview: five lightweight rows. */
.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bars {
  gap: 5px;
  margin-top: 2px;
  padding-top: 0;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bar-row {
  grid-template-columns: minmax(125px, 190px) minmax(140px, 1fr) auto;
  gap: 7px;
  min-height: 20px;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-bar-label,
.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bar-row > strong {
  font-size: .56rem;
  line-height: 1.1;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-bar-track {
  height: 10px;
}

/* Returns preview: show only the essential line and bar. The detailed reason
   pills remain available when this widget is maximized. */
.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .sales-card-actions {
  margin-right: 58px;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .sales-card-actions .metric-chip {
  min-height: 24px;
  padding: 4px 8px;
  font-size: .56rem;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bars {
  display: grid;
  gap: 5px;
  height: auto;
  max-height: none;
  overflow: hidden;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-row:nth-of-type(n+6) {
  display: none;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .compact-return-row {
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 6px;
  min-height: 31px;
  padding: 4px 7px;
  border-radius: 11px;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .compact-return-row .return-bar-rank {
  min-height: 24px;
  border-radius: 8px;
  font-size: .57rem;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-topline {
  gap: 6px;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-title {
  gap: 5px;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-title strong,
.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-title span,
.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-metric {
  font-size: .61rem;
  line-height: 1.1;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-track {
  height: 6px;
  margin: 3px 0 0;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-meta {
  display: none;
}

/* Restore the detailed returns rows in full-screen mode. */
.dashboard-theme .sales-return-widget.is-widget-maximized .compact-return-row {
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  min-height: auto;
  padding: 10px 12px;
  border-radius: 17px;
}

.dashboard-theme .sales-return-widget.is-widget-maximized .compact-return-row .return-bar-rank {
  min-height: 38px;
  border-radius: 13px;
  font-size: .8rem;
}

.dashboard-theme .sales-return-widget.is-widget-maximized .return-bar-meta {
  display: flex;
}

/* Maximizing Top articles now means exactly one thing: replace the compact
   preview with the complete chart. The secondary table is intentionally not
   shown here, avoiding the impression that two reports were opened at once. */
.dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-widget-preview {
  display: none !important;
}

.dashboard-theme .sales-top-products-widget.is-widget-maximized > .card-heading {
  min-height: 0;
  height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
}

.dashboard-theme .sales-top-products-widget.is-widget-maximized > .card-heading > div:not(.widget-control-group) {
  display: none;
}

.dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-widget-detail {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-top: 4px;
}

.dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-heading {
  flex: 0 0 auto;
  margin: 0 48px 10px 0;
}

.dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-table {
  display: none !important;
}

.dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-chart {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  overflow: auto;
}

.dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-chart canvas {
  max-width: 100%;
}

/* Override the v4 side-by-side full-screen layout. */
@media (min-width: 1000px) and (min-height: 700px) {
  .dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-widget-detail {
    display: flex;
    grid-template-columns: none;
    grid-template-rows: none;
    gap: 0;
  }

  .dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-heading,
  .dashboard-theme .sales-top-products-widget.is-widget-maximized .sales-expanded-chart {
    grid-column: auto;
    grid-row: auto;
  }
}

/* ========================================================================== */
/* Delidips refinement v6 — fixed classic rail + full-height sales cards      */
/* ========================================================================== */

/* Restore the original fixed navigation rail: icon above label, without the
   compact/expanded horizontal mode. */
.dashboard-theme {
  --sidebar-compact-width: 92px;
  --sidebar-expanded-width: 92px;
  --sidebar-left: 30px;
  --sidebar-gap: 20px;
}

.dashboard-theme .dashboard-sidebar-toggle {
  display: none !important;
}

@media (min-width: 901px) {
  .dashboard-theme .app-shell,
  .dashboard-theme.sidebar-expanded .app-shell {
    padding-left: 142px;
  }

  .dashboard-theme .dashboard-sidebar,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar {
    left: 30px;
    width: 92px;
    padding: 16px 10px 14px;
    align-items: center;
    border-radius: 30px;
    box-shadow: none;
  }

  .dashboard-theme .dashboard-sidebar-header,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-header {
    justify-content: center;
  }

  .dashboard-theme .dashboard-sidebar-brand,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 62px;
    height: 58px;
    margin: 0 0 13px;
    padding: 5px 4px;
    border-radius: 18px;
    background: #faf7ef;
    overflow: hidden;
  }

  .dashboard-theme .dashboard-brand-mark,
  .dashboard-theme.sidebar-expanded .dashboard-brand-mark {
    display: block;
    width: auto;
    height: auto;
    flex: 0 0 auto;
    overflow: visible;
    border-radius: 0;
    color: #11181c;
    background: transparent;
    opacity: 1;
    font-size: .82rem;
    font-weight: 950;
    line-height: 1;
    letter-spacing: -.02em;
  }

  .dashboard-theme .dashboard-brand-name,
  .dashboard-theme.sidebar-expanded .dashboard-brand-name {
    display: block;
    max-width: 54px;
    color: #11181c;
    font-size: .46rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .dashboard-theme .dashboard-nav-section,
  .dashboard-theme.sidebar-expanded .dashboard-nav-section {
    gap: 4px;
  }

  .dashboard-theme .dashboard-nav-section-title,
  .dashboard-theme.sidebar-expanded .dashboard-nav-section-title {
    display: block;
    padding: 1px 2px 4px;
    color: rgba(250, 247, 239, .48);
    font-size: .46rem;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 52px;
    padding: 6px 3px;
    border-radius: 17px;
    font-size: .56rem;
    line-height: 1.08;
    text-align: center;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button .ui-icon,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button .ui-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button > span:last-child,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button > span:last-child {
    display: block;
    max-width: 68px;
    white-space: normal;
  }

  .dashboard-theme .dashboard-sidebar-foot,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 3px 2px;
    font-size: .57rem;
    text-align: center;
  }

  .dashboard-theme .dashboard-sidebar-foot > span:last-child,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot > span:last-child {
    display: block;
  }
}

/* Sales tabs use the remaining viewport. If a selected tab has no cards below,
   its cards extend to the bottom of the workspace instead of leaving a large
   unused area. */
@media (min-width: 1121px) and (min-height: 760px) {
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-tabbed-shell,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-section-panel.is-active,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-panel-grid {
    min-height: 0;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-section-panel.is-active {
    height: 100%;
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-panel-grid {
    height: 100%;
    align-content: stretch;
    align-items: stretch;
    grid-auto-rows: minmax(0, 1fr);
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-compact-widget,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-products-grid > .sales-compact-widget,
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-panel-grid:not(.sales-products-grid) > .sales-compact-widget {
    height: 100%;
    min-height: 0;
    max-height: none;
  }
}

/* The compact product ranking honors the selected Top filter. With Top 10 all
   rows fit at 1920x1080; Top 20/30 remain available with an internal card
   scroll instead of making the whole page scroll. */
.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-widget-preview {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bars {
  display: grid;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  gap: 6px;
  margin-top: 2px;
  padding: 1px 4px 2px 0;
  align-content: start;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bar-row {
  grid-template-columns: minmax(150px, 215px) minmax(150px, 1fr) auto;
  gap: 8px;
  min-height: 22px;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-bar-label,
.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bar-row > strong {
  font-size: .64rem;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-bar-track {
  height: 10px;
}

/* Returns uses the same available height and can show the complete selected
   ranking. Long Top 20/30 lists scroll only inside this card. */
.dashboard-theme .sales-return-widget:not(.is-widget-maximized) {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bars {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  gap: 4px;
  padding-right: 3px;
  align-content: start;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-row:nth-of-type(n+6) {
  display: grid;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .compact-return-row {
  min-height: 28px;
  padding-top: 3px;
  padding-bottom: 3px;
}

/* Clients follows the selected Top filter as well and fills its otherwise empty
   tab. */
.dashboard-theme .sales-clients-widget:not(.is-widget-maximized) {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .sales-clients-widget:not(.is-widget-maximized) .sales-widget-preview {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  min-height: 0;
  overflow: hidden;
}

.dashboard-theme .sales-clients-widget:not(.is-widget-maximized) .sales-client-bars {
  max-height: 100%;
  gap: 7px;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dashboard-theme .sales-clients-widget:not(.is-widget-maximized) .sales-client-bars > div {
  min-height: 22px;
  font-size: .61rem;
}

@media (min-width: 901px) {
  .dashboard-theme .dashboard-sidebar,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar {
    overflow: hidden;
  }
}

/* ========================================================================== */
/* Delidips refinement v7 — balanced cards + widget modal                    */
/* ========================================================================== */

/* Maximizing a widget now opens it as a centered modal instead of turning
   the card into a full-screen page. Nested application modals keep z-index 80,
   so they still appear above this widget modal. */
.widget-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 42px);
  background: rgba(8, 39, 32, 0.46);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.widget-modal-backdrop > .is-widget-maximized {
  position: relative !important;
  inset: auto !important;
  z-index: 1 !important;
  width: min(var(--widget-modal-width, 960px), calc(100vw - 52px)) !important;
  max-width: calc(100vw - 52px) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 52px) !important;
  margin: 0 !important;
  padding: clamp(16px, 1.8vw, 24px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  border-radius: 24px !important;
  background: var(--panel-solid) !important;
  box-shadow: 0 28px 90px rgba(8, 29, 24, 0.34) !important;
  isolation: isolate;
}

.widget-modal-backdrop > .is-widget-maximized > .card-heading,
.widget-modal-backdrop > .is-widget-maximized > [data-widget-heading] {
  position: relative;
  top: auto;
  background: transparent;
}

/* On desktop, give Returns enough width to keep article names readable while
   preserving a larger area for the sales quantity ranking. */
@media (min-width: 1121px) {
  .dashboard-theme .sales-products-grid {
    grid-template-columns: minmax(0, 1.42fr) minmax(440px, 1fr);
    gap: 12px;
  }
}

/* Main sales cards are information panels, not thumbnails. Use the available
   vertical area but keep each Top 10 row legible. */
.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) {
  padding: 14px 16px 15px;
}

.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) > .card-heading {
  min-height: 52px;
  margin-bottom: 7px;
}

.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) .sales-overview-heading h2,
.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) > .card-heading h2 {
  font-size: 1.04rem;
  line-height: 1.16;
}

.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) .sales-overview-heading p,
.dashboard-theme .sales-compact-widget:not(.is-widget-maximized) > .card-heading p {
  font-size: .61rem;
  line-height: 1.3;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bars {
  gap: 7px;
  padding-right: 5px;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bar-row {
  grid-template-columns: minmax(175px, 235px) minmax(150px, 1fr) minmax(48px, auto);
  gap: 9px;
  min-height: 25px;
  align-items: center;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-bar-label,
.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bar-row > strong {
  font-size: .66rem;
  line-height: 1.15;
}

.dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-bar-track {
  height: 11px;
}

@media (max-width: 680px) {
  .dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-overview-bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 8px;
  }

  .dashboard-theme .sales-top-products-widget:not(.is-widget-maximized) .sales-bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bars {
  gap: 5px;
  padding-right: 4px;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .compact-return-row {
  grid-template-columns: 31px minmax(0, 1fr);
  gap: 7px;
  min-height: 31px;
  padding: 4px 7px;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .compact-return-row .return-bar-rank {
  min-height: 24px;
  font-size: .61rem;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-title strong,
.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-title span,
.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-metric {
  font-size: .66rem;
  line-height: 1.15;
}

.dashboard-theme .sales-return-widget:not(.is-widget-maximized) .return-bar-track {
  height: 7px;
  margin-top: 4px;
}

/* The sales chart modal is intentionally large enough for a ten-row ranking,
   but it remains a card-sized dialog rather than using the whole monitor. */
.dashboard-theme .widget-modal-backdrop > .sales-top-products-widget.is-widget-maximized {
  max-width: 1120px !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-top-products-widget.is-widget-maximized .sales-widget-detail {
  flex: 0 1 auto;
  overflow: visible;
}

.dashboard-theme .widget-modal-backdrop > .sales-top-products-widget.is-widget-maximized .sales-expanded-heading {
  margin: 0 52px 12px 0;
}

.dashboard-theme .widget-modal-backdrop > .sales-top-products-widget.is-widget-maximized .sales-expanded-chart {
  flex: 0 1 auto;
  width: 100%;
  min-height: 420px;
  max-height: min(560px, calc(100dvh - 190px));
  overflow: hidden;
}

/* Returns grows only as much as its content needs; if a Top 20/30 list is
   selected, the modal gets its own scroll instead of growing past the screen. */
.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized {
  max-width: 760px !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bars {
  max-height: calc(100dvh - 190px);
  overflow-y: auto;
  padding-right: 5px;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .compact-return-row {
  min-height: 50px;
}

@media (max-width: 760px) {
  .widget-modal-backdrop {
    padding: 10px;
  }

  .widget-modal-backdrop > .is-widget-maximized {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    border-radius: 18px !important;
  }
}

.dashboard-theme .widget-modal-backdrop > .sales-compact-widget.is-widget-maximized {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* ========================================================================== */
/* Delidips refinement v8 — content-aware widget modal sizing                 */
/* ========================================================================== */

/* The modal is allowed to size to its content. Previous versions inherited
   full-screen flex rules and a 420-540px chart minimum, which made compact
   widgets look either too narrow or unnecessarily tall. */
.widget-modal-backdrop {
  padding: clamp(22px, 4vh, 46px) clamp(22px, 4vw, 54px);
}

.widget-modal-backdrop > .is-widget-maximized {
  width: min(var(--widget-modal-width, 920px), calc(100vw - 44px)) !important;
  max-width: calc(100vw - 44px) !important;
  height: fit-content !important;
  max-height: calc(100dvh - 56px) !important;
  align-self: center;
  padding: clamp(16px, 1.35vw, 22px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* Customer collections needs a bounded flex viewport so its chart uses the available modal height. */
.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized {
  min-height: 0 !important;
  height: min(82dvh, 780px) !important;
  max-height: calc(100dvh - 56px) !important;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-chart-wrap {
  min-height: 0 !important;
  overflow: hidden !important;
}

/* Constrained mobile/landscape viewports use the modal as the only scroll region. */
@media (max-width: 760px) and (max-height: 640px), (max-height: 480px) {
  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized {
    height: auto !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-chart-wrap {
    flex: 0 0 220px;
    min-height: 220px !important;
  }
}

/* Product ranking: one chart, sized from the number of bars by JavaScript.
   Do not let old full-screen flex declarations stretch the chart wrapper. */
.dashboard-theme .widget-modal-backdrop > .sales-top-products-widget.is-widget-maximized {
  max-width: 1040px !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-top-products-widget.is-widget-maximized .sales-widget-detail {
  display: block !important;
  flex: none !important;
  width: 100%;
  min-height: 0 !important;
  overflow: visible !important;
  padding-top: 2px;
}

.dashboard-theme .widget-modal-backdrop > .sales-top-products-widget.is-widget-maximized .sales-expanded-heading {
  margin: 0 50px 10px 0;
}

.dashboard-theme .widget-modal-backdrop > .sales-top-products-widget.is-widget-maximized .sales-expanded-chart {
  display: block !important;
  flex: none !important;
  width: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-top-products-widget.is-widget-maximized .sales-expanded-chart canvas {
  display: block;
  max-width: 100%;
}

/* Returns: the compact dashboard card is narrow by design, but the expanded
   information needs enough horizontal space for article, metric and metadata.
   Let rows grow naturally and wrap metadata instead of overlapping it. */
.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized {
  max-width: 980px !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized > .card-heading {
  margin-bottom: 10px;
  padding-right: 58px;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bars {
  display: grid;
  gap: 7px;
  width: 100%;
  max-height: min(650px, calc(100dvh - 220px));
  padding-right: 5px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .compact-return-row {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  height: auto;
  padding: 8px 10px;
  border-radius: 14px;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .compact-return-row .return-bar-rank {
  min-height: 38px;
  align-self: stretch;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bar-topline {
  gap: 10px;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bar-title {
  min-width: 0;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bar-title span {
  min-width: 0;
  font-size: .78rem;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bar-metric {
  font-size: .8rem;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bar-track {
  height: 9px;
  margin: 6px 0;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bar-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 5px 7px;
}

.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bar-meta span,
.dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-reasons-button {
  min-height: 22px;
  padding-inline: 7px;
  font-size: .67rem;
  line-height: 1.15;
}

@media (max-width: 900px) {
  .widget-modal-backdrop {
    padding: 12px;
  }

  .widget-modal-backdrop > .is-widget-maximized {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
  }

  .dashboard-theme .widget-modal-backdrop > .sales-return-widget.is-widget-maximized .return-bar-meta {
    display: none;
  }
}

/* ========================================================================== */
/* Delidips refinement v11 — sales client modal content cleanup               */
/* ========================================================================== */

/* The Clients widget represents one ranking: clients by purchase amount.
   In expanded mode it must not render the secondary quantity table side by
   side, because that reads as unrelated content inside the same modal. Keep
   the chart plus the main monetary ranking table only. */
.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized {
  max-width: 1040px !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-widget-detail {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-height: 0 !important;
  overflow: visible !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-heading {
  margin: 0 50px 10px 0;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-chart {
  min-height: 0 !important;
  max-height: min(430px, calc(100dvh - 360px));
  overflow: hidden;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-tables {
  display: block !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-tables .ranking-table-wrap {
  max-height: min(260px, calc(100dvh - 500px));
  overflow: auto;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-tables .ranking-table-wrap + .ranking-table-wrap {
  display: none !important;
}

@media (max-width: 900px) {
  .dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-chart {
    max-height: min(360px, calc(100dvh - 320px));
  }

  .dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-tables .ranking-table-wrap {
    max-height: none;
  }
}


/* ========================================================================== */
/* Delidips refinement v12 — sales clients modal should show one view only    */
/* ========================================================================== */

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized {
  max-width: 1000px !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-widget-detail {
  display: block !important;
  min-height: 0 !important;
  overflow: visible !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-heading {
  margin: 0 50px 10px 0;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-chart {
  width: 100%;
  min-height: 0 !important;
  max-height: min(520px, calc(100dvh - 210px));
  overflow: hidden;
}

.dashboard-theme .widget-modal-backdrop > .sales-clients-widget.is-widget-maximized .sales-expanded-tables {
  display: none !important;
}


/* ========================================================================== */
/* Delidips refinement v13 — crisp modal typography + branded dark surfaces   */
/* ========================================================================== */

/* Avoid synthetic ultra-bold faces inside dialogs. Manrope is loaded up to
   800, so letting the browser fake 900/950 can look soft at Windows scaling. */
.dashboard-theme,
.widget-modal-backdrop > .is-widget-maximized {
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Keep the modal overlay lightweight. A strong backdrop blur promotes a large
   composited layer in Chromium and can make small text/canvas content look
   softer on some Windows scaling configurations. */
.widget-modal-backdrop {
  background: rgba(8, 12, 14, .50);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.widget-modal-backdrop > .is-widget-maximized {
  border-color: rgba(255, 255, 255, .72) !important;
  box-shadow:
    0 32px 90px rgba(7, 10, 12, .36),
    0 2px 0 rgba(245, 159, 47, .18) inset !important;
}

/* Chart canvases use a 2x-or-better backing store in JavaScript; never apply
   CSS pixelation or transforms to them. */
.dashboard-theme canvas {
  image-rendering: auto;
  transform: none;
}

/* Main navigation: retain the black identity but give it depth with a very
   restrained graphite gradient and an orange halo borrowed from the logo. */
.dashboard-theme .dashboard-sidebar {
  border: 1px solid rgba(255, 255, 255, .045);
  background:
    radial-gradient(circle at 50% 2%, rgba(245, 159, 47, .16) 0, rgba(245, 159, 47, .05) 78px, transparent 150px),
    linear-gradient(180deg, #171f24 0%, #10171b 44%, #090e11 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.055),
    inset -1px 0 0 rgba(245,159,47,.05),
    0 14px 32px rgba(10,14,17,.10);
}

.dashboard-theme .dashboard-sidebar .dashboard-nav-button:hover {
  color: #fff;
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(245,159,47,.08));
}

.dashboard-theme .dashboard-sidebar .dashboard-nav-button.is-active {
  color: #11181c;
  background: linear-gradient(145deg, #fffdf8 0%, #f4eee3 100%);
  box-shadow:
    inset 0 -2px 0 rgba(245,159,47,.72),
    0 5px 14px rgba(0,0,0,.09);
}

/* Header shared by every dashboard tab. It stays almost black but receives a
   subtle orange light source and a thin accent at the lower left. */
.dashboard-theme .dashboard-hero {
  position: relative;
  border: 1px solid rgba(245,159,47,.13);
  background:
    radial-gradient(circle at 91% -35%, rgba(245,159,47,.25) 0, rgba(245,159,47,.08) 150px, transparent 290px),
    linear-gradient(120deg, #0d1317 0%, #182126 52%, #0c1215 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.055),
    0 9px 24px rgba(10,14,17,.09);
}

.dashboard-theme .dashboard-hero::after {
  position: absolute;
  right: auto;
  bottom: 0;
  left: 18px;
  display: block !important;
  width: min(210px, 28%);
  height: 2px;
  border-radius: 999px;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, rgba(245,159,47,.95), rgba(245,159,47,.26), transparent);
}

.dashboard-theme .dashboard-hero .eyebrow {
  color: #f7b457;
}

/* Dark controls use the same graphite treatment instead of a flat black fill. */
.dashboard-theme .filter-toggle-text,
.dashboard-theme .period-filter-link,
.dashboard-theme .sales-overview-kpi.is-primary,
.dashboard-theme .kpi-main {
  background: linear-gradient(135deg, #11181c 0%, #20292e 74%, #292b25 100%);
  box-shadow: inset 0 -1px 0 rgba(245,159,47,.16);
}

.dashboard-theme .sales-section-tabs .sales-section-tab.is-active,
.dashboard-theme .sales-section-tabs a.is-active {
  color: #fff;
  background: linear-gradient(135deg, #10171b 0%, #252d31 78%, #49371f 100%);
  box-shadow:
    inset 0 -2px 0 rgba(245,159,47,.76),
    inset 0 1px 0 rgba(255,255,255,.04);
}

.dashboard-theme .sales-section-tabs .sales-section-tab:hover,
.dashboard-theme .sales-section-tabs .sales-section-link:hover,
.dashboard-theme .sales-section-tabs a:hover {
  background: linear-gradient(135deg, rgba(17,24,28,.06), rgba(245,159,47,.08));
}

/* Slightly larger modal chart text improves legibility without increasing the
   modal itself. */
.dashboard-theme .widget-modal-backdrop .sales-expanded-heading h3 {
  font-weight: 800;
}

.dashboard-theme .widget-modal-backdrop .sales-expanded-heading p,
.dashboard-theme .widget-modal-backdrop .card-heading p {
  color: #6a716e;
  font-size: .7rem;
}

/* ========================================================================== */
/* Delidips refinement v14 — compact Stock previews + modal detail            */
/* ========================================================================== */

.dashboard-theme .stock-compact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  gap: 14px;
  margin-top: 14px;
}

.dashboard-theme .stock-compact-widget {
  min-width: 0;
  height: clamp(330px, 42vh, 420px);
  padding: 16px 18px;
  overflow: hidden;
  border-radius: 20px;
}

.dashboard-theme .stock-compact-widget > .card-heading {
  margin-bottom: 12px;
  padding-right: 74px;
}

.dashboard-theme .stock-compact-widget > .card-heading h2 {
  margin-top: 4px;
  font-size: clamp(1rem, 1.25vw, 1.22rem);
}

.dashboard-theme .stock-compact-widget > .card-heading .chart-insight {
  max-width: 720px;
  margin-top: 3px;
  overflow: hidden;
  color: #747b7e;
  font-size: .63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .stock-compact-widget .widget-control-group {
  top: 10px;
  right: 10px;
}

.dashboard-theme .stock-widget-preview {
  display: block;
  min-height: 0;
}

.dashboard-theme .stock-widget-detail {
  display: none;
}

.dashboard-theme .stock-family-preview-list {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.dashboard-theme .stock-family-preview-row {
  display: grid;
  grid-template-columns: minmax(110px, .72fr) minmax(170px, 1.75fr) auto;
  gap: 11px;
  align-items: center;
  min-width: 0;
}

.dashboard-theme .stock-family-preview-label {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.dashboard-theme .stock-family-preview-label strong {
  overflow: hidden;
  color: #1a2328;
  font-size: .7rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .stock-family-preview-label small {
  color: #858b8d;
  font-size: .57rem;
  font-weight: 700;
}

.dashboard-theme .stock-family-preview-track {
  display: block;
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e3dc;
}

.dashboard-theme .stock-family-preview-track i {
  display: block;
  width: var(--stock-preview-width);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #11181c 0%, #283137 72%, #f59f2f 100%);
}

.dashboard-theme .stock-family-preview-row > b {
  min-width: 54px;
  color: #313a3f;
  font-size: .66rem;
  font-weight: 850;
  text-align: right;
}

.dashboard-theme .stock-lot-preview-list {
  display: grid;
  gap: 7px;
  padding-top: 2px;
}

.dashboard-theme .stock-lot-preview-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 43px;
  padding: 6px 8px;
  border: 1px solid #e3ddd3;
  border-radius: 12px;
  background: rgba(255,255,255,.62);
}

.dashboard-theme .stock-lot-date {
  display: grid;
  min-height: 29px;
  place-items: center;
  border-radius: 9px;
  color: #11181c;
  background: linear-gradient(135deg, rgba(245,159,47,.24), rgba(245,159,47,.08));
  box-shadow: inset 0 0 0 1px rgba(216,132,16,.18);
  font-size: .66rem;
  font-weight: 900;
}

.dashboard-theme .stock-lot-main {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.dashboard-theme .stock-lot-main strong {
  overflow: hidden;
  color: #11181c;
  font-size: .67rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .stock-lot-main small {
  overflow: hidden;
  color: #7a8184;
  font-size: .56rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .stock-lot-preview-row > b {
  min-width: 58px;
  color: #313a3f;
  font-size: .66rem;
  font-weight: 850;
  text-align: right;
}

.dashboard-theme .widget-modal-backdrop > .stock-compact-widget.is-widget-maximized {
  height: fit-content !important;
  min-height: 0 !important;
}

.dashboard-theme .widget-modal-backdrop > .stock-compact-widget.is-widget-maximized .stock-widget-preview {
  display: none !important;
}

.dashboard-theme .widget-modal-backdrop > .stock-compact-widget.is-widget-maximized .stock-widget-detail {
  display: block !important;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized {
  max-width: 1040px !important;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized .stock-expanded-chart {
  width: 100%;
  height: min(480px, calc(100dvh - 240px));
  min-height: 330px;
  overflow: hidden;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-detail-widget.is-widget-maximized {
  max-width: 1160px !important;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-detail-widget.is-widget-maximized .stock-expanded-table {
  width: 100%;
  max-height: min(590px, calc(100dvh - 225px));
  overflow: auto;
}

@media (max-width: 1120px) {
  .dashboard-theme .stock-compact-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .stock-compact-widget {
    height: auto;
    min-height: 320px;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .stock-family-preview-row {
    grid-template-columns: minmax(90px, .8fr) minmax(120px, 1.4fr) auto;
    gap: 7px;
  }

  .dashboard-theme .stock-lot-preview-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }

  .dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized .stock-expanded-chart {
    height: min(420px, calc(100dvh - 220px));
    min-height: 280px;
  }
}

/* ========================================================================== */
/* Delidips refinement v15 — stock lot preview internal scrolling             */
/* ========================================================================== */

/* Keep the compact lot card inside its fixed dashboard height. The heading
   remains fixed and only the list scrolls when the available viewport height
   is not enough for every preview row. */
.dashboard-theme .stock-expiry-detail-widget {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .stock-expiry-detail-widget > .card-heading {
  flex: 0 0 auto;
}

.dashboard-theme .stock-expiry-detail-widget > .stock-widget-preview {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.dashboard-theme .stock-expiry-detail-widget:not(.is-widget-maximized) .stock-lot-preview-list {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 7px 7px 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 92, 91, .55) transparent;
}

.dashboard-theme .stock-expiry-detail-widget:not(.is-widget-maximized) .stock-lot-preview-list::-webkit-scrollbar {
  width: 7px;
}

.dashboard-theme .stock-expiry-detail-widget:not(.is-widget-maximized) .stock-lot-preview-list::-webkit-scrollbar-track {
  background: transparent;
}

.dashboard-theme .stock-expiry-detail-widget:not(.is-widget-maximized) .stock-lot-preview-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(90, 92, 91, .52);
  background-clip: padding-box;
}

.dashboard-theme .stock-expiry-detail-widget:not(.is-widget-maximized) .stock-lot-preview-list::-webkit-scrollbar-thumb:hover {
  background: rgba(17, 24, 28, .70);
  background-clip: padding-box;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-detail-widget.is-widget-maximized .stock-widget-detail {
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 1120px) {
  .dashboard-theme .stock-expiry-detail-widget > .stock-widget-preview {
    flex: none;
    overflow: visible;
  }

  .dashboard-theme .stock-expiry-detail-widget:not(.is-widget-maximized) .stock-lot-preview-list {
    height: auto;
    max-height: 310px;
  }
}


/* ========================================================================== */
/* Delidips refinement v16 — aligned widget actions + cleaner stock detail    */
/* ========================================================================== */

/* Widget action buttons should sit consistently in the upper-right corner of
   dashboard cards and modals. Some cards append the control group inside the
   heading, so anchor it absolutely there instead of leaving it in normal flow. */
.dashboard-theme .chart-card.has-widget-controls > .card-heading,
.dashboard-theme .table-card.has-widget-controls > .card-heading,
.dashboard-theme .stock-compact-widget.has-widget-controls > .card-heading {
  position: relative;
  padding-right: 88px;
}

.dashboard-theme .chart-card.has-widget-controls > .card-heading > .widget-control-group,
.dashboard-theme .table-card.has-widget-controls > .card-heading > .widget-control-group,
.dashboard-theme .stock-compact-widget.has-widget-controls > .card-heading > .widget-control-group {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  gap: 8px;
  margin-left: 0;
}

.dashboard-theme .widget-modal-backdrop > .is-widget-maximized > .card-heading {
  padding-right: 94px;
}

.dashboard-theme .widget-modal-backdrop > .is-widget-maximized > .card-heading > .widget-control-group {
  top: 2px;
  right: 0;
}

/* Improve the stock expiry modal table so the article code/name area uses the
   available width better and avoids awkward wraps. */
.dashboard-theme .widget-modal-backdrop > .stock-expiry-detail-widget.is-widget-maximized {
  max-width: 1280px !important;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-detail-widget.is-widget-maximized .stock-expanded-table {
  width: 100%;
  max-height: min(610px, calc(100dvh - 220px));
  overflow: auto;
}

.dashboard-theme .stock-expiry-table {
  min-width: 1100px;
  table-layout: fixed;
}

.dashboard-theme .stock-expiry-table .stock-col-family,
.dashboard-theme .stock-expiry-table .stock-family-cell {
  width: 16%;
}

.dashboard-theme .stock-expiry-table .stock-col-article,
.dashboard-theme .stock-expiry-table .stock-article-cell {
  width: 34%;
}

.dashboard-theme .stock-expiry-table .stock-col-batch,
.dashboard-theme .stock-expiry-table .stock-batch-cell {
  width: 12%;
}

.dashboard-theme .stock-expiry-table .stock-col-deposit,
.dashboard-theme .stock-expiry-table .stock-deposit-cell {
  width: 18%;
}

.dashboard-theme .stock-expiry-table .stock-col-date,
.dashboard-theme .stock-expiry-table .stock-date-cell {
  width: 12%;
  white-space: nowrap;
}

.dashboard-theme .stock-expiry-table .stock-col-available,
.dashboard-theme .stock-expiry-table .stock-available-cell {
  width: 12%;
  white-space: nowrap;
}

.dashboard-theme .stock-expiry-table td {
  vertical-align: middle;
}

.dashboard-theme .stock-expiry-table .stock-family-cell,
.dashboard-theme .stock-expiry-table .stock-batch-cell,
.dashboard-theme .stock-expiry-table .stock-deposit-cell,
.dashboard-theme .stock-expiry-table .stock-date-cell,
.dashboard-theme .stock-expiry-table .stock-available-cell {
  font-size: 0.88rem;
}

.dashboard-theme .stock-expiry-table .stock-article-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.dashboard-theme .stock-expiry-table .stock-article-code {
  display: inline-flex;
  align-items: center;
  align-self: start;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #4c545a;
  background: rgba(17, 24, 28, .06);
  font-size: 0.73rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.dashboard-theme .stock-expiry-table .stock-article-name {
  display: block;
  min-width: 0;
  color: #11181c;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

@media (max-width: 1024px) {
  .dashboard-theme .chart-card.has-widget-controls > .card-heading,
  .dashboard-theme .table-card.has-widget-controls > .card-heading,
  .dashboard-theme .stock-compact-widget.has-widget-controls > .card-heading,
  .dashboard-theme .widget-modal-backdrop > .is-widget-maximized > .card-heading {
    padding-right: 84px;
  }

  .dashboard-theme .stock-expiry-table {
    min-width: 980px;
  }
}


/* ========================================================================== */
/* Delidips refinement v17 — repair stock expiry modal table layout           */
/* ========================================================================== */

.dashboard-theme .widget-modal-backdrop > .stock-expiry-detail-widget.is-widget-maximized {
  max-width: 1240px !important;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-detail-widget.is-widget-maximized .stock-expanded-table {
  width: 100%;
  max-height: min(610px, calc(100dvh - 220px));
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
}

.dashboard-theme .stock-expiry-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

.dashboard-theme .stock-expiry-table col.stock-col-family { width: 12%; }
.dashboard-theme .stock-expiry-table col.stock-col-article { width: 34%; }
.dashboard-theme .stock-expiry-table col.stock-col-batch { width: 12%; }
.dashboard-theme .stock-expiry-table col.stock-col-deposit { width: 18%; }
.dashboard-theme .stock-expiry-table col.stock-col-date { width: 14%; }
.dashboard-theme .stock-expiry-table col.stock-col-available { width: 10%; }

.dashboard-theme .stock-expiry-table .stock-family-cell,
.dashboard-theme .stock-expiry-table .stock-article-cell,
.dashboard-theme .stock-expiry-table .stock-batch-cell,
.dashboard-theme .stock-expiry-table .stock-deposit-cell,
.dashboard-theme .stock-expiry-table .stock-date-cell,
.dashboard-theme .stock-expiry-table .stock-available-cell {
  display: table-cell !important;
  width: auto !important;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.dashboard-theme .stock-expiry-table th,
.dashboard-theme .stock-expiry-table td {
  padding-left: 12px;
  padding-right: 12px;
}

.dashboard-theme .stock-expiry-table .stock-article-cell {
  white-space: normal;
}

.dashboard-theme .stock-expiry-table .stock-article-info {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  width: 100%;
}

.dashboard-theme .stock-expiry-table .stock-article-code {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #596166;
  background: rgba(17, 24, 28, .06);
  font-size: .70rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-theme .stock-expiry-table .stock-article-name {
  flex: 1 1 auto;
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #11181c;
  font-size: .84rem;
  font-weight: 800;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .stock-expiry-table .stock-family-cell,
.dashboard-theme .stock-expiry-table .stock-batch-cell,
.dashboard-theme .stock-expiry-table .stock-deposit-cell,
.dashboard-theme .stock-expiry-table .stock-date-cell,
.dashboard-theme .stock-expiry-table .stock-available-cell {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .dashboard-theme .widget-modal-backdrop > .stock-expiry-detail-widget.is-widget-maximized .stock-expanded-table {
    overflow-x: auto;
  }

  .dashboard-theme .stock-expiry-table {
    min-width: 900px !important;
  }
}


/* ========================================================================== */
/* Delidips refinement v18 — stock expiry chart fills its modal correctly     */
/* ========================================================================== */

/* The generic .chart-card canvas rule fixes canvases at 300px. In the stock
   expiry modal the wrapper is substantially taller, so the chart only used the
   upper portion of the dialog and left a large empty area below. Let this chart
   inherit the modal's content height instead. */
.dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized {
  max-width: 1120px !important;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized .stock-widget-detail {
  width: 100%;
  min-height: 0 !important;
  overflow: visible !important;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized .stock-expanded-chart {
  position: relative;
  width: 100%;
  height: clamp(390px, 48dvh, 500px) !important;
  min-height: 390px !important;
  max-height: 500px !important;
  margin: 0;
  overflow: hidden;
}

.dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized .stock-expanded-chart canvas,
.dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized #expiringStockChart {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

@media (max-height: 760px) {
  .dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized .stock-expanded-chart {
    height: min(390px, calc(100dvh - 250px)) !important;
    min-height: 300px !important;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .widget-modal-backdrop > .stock-expiry-chart-widget.is-widget-maximized .stock-expanded-chart {
    height: min(420px, calc(100dvh - 230px)) !important;
    min-height: 300px !important;
  }
}


/* ========================================================================== */
/* Delidips refinement v19 — compact purchase previews + modal detail charts  */
/* ========================================================================== */

.dashboard-theme .purchase-compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.dashboard-theme .purchase-compact-widget {
  position: relative;
  min-width: 0;
  height: clamp(300px, 35vh, 360px);
  min-height: 300px;
  padding: 16px 17px;
  overflow: hidden;
  border-radius: 20px;
}

.dashboard-theme .purchase-compact-widget > .card-heading {
  position: relative;
  min-height: 86px;
  margin-bottom: 10px;
  padding-right: 84px;
}

.dashboard-theme .purchase-compact-widget > .card-heading > div:first-child {
  min-width: 0;
  max-width: 100%;
}

.dashboard-theme .purchase-compact-widget > .card-heading h2 {
  margin-top: 4px;
  font-size: clamp(.96rem, 1.08vw, 1.12rem);
  line-height: 1.1;
}

.dashboard-theme .purchase-compact-widget > .card-heading .chart-insight {
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: #7a8082;
  font-size: .60rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .purchase-compact-widget > .card-heading > .metric-chip {
  position: absolute;
  top: 0;
  right: 82px;
  min-height: 27px;
  padding: 4px 8px;
  font-size: .60rem;
}

.dashboard-theme .purchase-compact-widget > .card-heading > .widget-control-group {
  position: absolute;
  top: 0;
  right: 0;
  gap: 7px;
  margin-left: 0;
}

.dashboard-theme .purchase-widget-preview {
  display: block;
  min-height: 0;
}

.dashboard-theme .purchase-widget-detail {
  display: none;
}

.dashboard-theme .purchase-mini-chart {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding-top: 6px;
}

.dashboard-theme .purchase-mini-row {
  display: grid;
  grid-template-columns: minmax(88px, .95fr) minmax(90px, 1.4fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.dashboard-theme .purchase-mini-label {
  display: flex;
  min-width: 0;
  gap: 5px;
  align-items: baseline;
  color: #586166;
  font-size: .62rem;
  line-height: 1.1;
  white-space: nowrap;
}

.dashboard-theme .purchase-mini-label b {
  flex: 0 0 auto;
  color: #2d363b;
  font-size: .60rem;
  font-weight: 850;
}

.dashboard-theme .purchase-mini-label em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
}

.dashboard-theme .purchase-mini-track {
  display: block;
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e3dc;
}

.dashboard-theme .purchase-mini-track i {
  display: block;
  width: var(--purchase-mini-width);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #11181c 0%, #2b3439 78%, #f59f2f 100%);
}

.dashboard-theme .purchase-mini-row.is-negative .purchase-mini-track i {
  background: linear-gradient(90deg, #d88410, #f59f2f);
}

.dashboard-theme .purchase-mini-row.is-delay .purchase-mini-track i {
  background: linear-gradient(90deg, #d88410 0%, #f59f2f 72%, #ffd398 100%);
}

.dashboard-theme .purchase-mini-row > strong {
  min-width: 58px;
  overflow: hidden;
  color: #30393e;
  font-size: .62rem;
  font-weight: 850;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .purchase-mini-row.is-negative > strong {
  color: #c87812;
}

.dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.is-widget-maximized {
  width: min(var(--widget-modal-width, 1040px), calc(100vw - 56px)) !important;
  max-width: 1040px !important;
  height: fit-content !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 56px) !important;
  padding: 18px 20px !important;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.is-widget-maximized > .card-heading {
  min-height: 0;
  margin-bottom: 12px;
  padding-right: 96px;
}

.dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.is-widget-maximized > .card-heading > .metric-chip {
  right: 84px;
}

.dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.is-widget-maximized .purchase-widget-preview {
  display: none !important;
}

.dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.is-widget-maximized .purchase-widget-detail {
  display: block !important;
  min-height: 0;
}

.dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.is-widget-maximized .purchase-expanded-chart {
  width: 100%;
  min-height: 320px;
  max-height: min(610px, calc(100dvh - 210px));
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.is-widget-maximized .purchase-expanded-chart canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

@media (max-width: 1320px) {
  .dashboard-theme .purchase-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-theme .purchase-compact-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .purchase-compact-widget {
    height: auto;
    min-height: 300px;
  }

  .dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.is-widget-maximized {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
  }
}

/* ========================================================================== */
/* Delidips refinement v20 — compact production previews + modal details      */
/* ========================================================================== */

.dashboard-theme .production-compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.dashboard-theme .production-compact-widget {
  position: relative;
  min-width: 0;
  height: clamp(305px, 35vh, 365px);
  min-height: 305px;
  padding: 16px 17px;
  overflow: hidden;
  border-radius: 20px;
  background: #fbf8f1;
}

.dashboard-theme .production-coverage-card {
  --coverage-billable: #11181c;
  --coverage-transfer: #f59f2f;
  --coverage-production: #707980;
  --coverage-orders: #d88410;
  background: #fbf8f1;
}

.dashboard-theme .production-compact-widget > .card-heading {
  position: relative;
  min-height: 94px;
  margin-bottom: 9px;
  padding-right: 84px;
}

.dashboard-theme .production-compact-widget > .card-heading > div:first-child {
  min-width: 0;
  max-width: 100%;
}

.dashboard-theme .production-compact-widget > .card-heading h2 {
  margin-top: 4px;
  font-size: clamp(.94rem, 1.06vw, 1.10rem);
  line-height: 1.12;
}

.dashboard-theme .production-compact-widget > .card-heading .chart-insight {
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: #7a8082;
  font-size: .60rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .production-compact-widget > .card-heading > .metric-chip {
  position: absolute;
  top: 0;
  right: 82px;
  min-height: 27px;
  padding: 4px 8px;
  font-size: .60rem;
}

.dashboard-theme .production-compact-widget > .card-heading > .widget-control-group {
  position: absolute;
  top: 0;
  right: 0;
  gap: 7px;
  margin-left: 0;
}

/* Coverage has two status chips in its full detail. Keep the most actionable
   shortage count in the compact header and restore both chips in the modal. */
.dashboard-theme .production-coverage-widget:not(.is-widget-maximized) .production-coverage-summary {
  position: absolute;
  top: 0;
  right: 82px;
  display: block;
  padding: 0;
}

.dashboard-theme .production-coverage-widget:not(.is-widget-maximized) .production-coverage-summary .metric-chip {
  min-height: 27px;
  padding: 4px 8px;
  font-size: .60rem;
}

.dashboard-theme .production-coverage-widget:not(.is-widget-maximized) .production-coverage-summary .is-surplus {
  display: none;
}

.dashboard-theme .production-widget-preview {
  display: block;
  min-height: 0;
}

.dashboard-theme .production-mini-chart {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding-top: 5px;
}

.dashboard-theme .production-mini-row {
  display: grid;
  grid-template-columns: minmax(92px, .95fr) minmax(92px, 1.42fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.dashboard-theme .production-mini-label {
  display: flex;
  min-width: 0;
  gap: 5px;
  align-items: baseline;
  color: #586166;
  font-size: .62rem;
  line-height: 1.1;
  white-space: nowrap;
}

.dashboard-theme .production-mini-label b {
  flex: 0 0 auto;
  color: #2d363b;
  font-size: .60rem;
  font-weight: 850;
}

.dashboard-theme .production-mini-label em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
}

.dashboard-theme .production-mini-track {
  position: relative;
  display: block;
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e3dc;
}

.dashboard-theme .production-mini-track > i {
  display: block;
  width: var(--production-mini-width);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #11181c 0%, #2b3439 76%, #f59f2f 100%);
}

.dashboard-theme .coverage-mini-track {
  overflow: visible;
  background: #e7e3dc;
}

.dashboard-theme .coverage-mini-track > i {
  overflow: hidden;
}

.dashboard-theme .coverage-mini-track > u {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: var(--production-order-position);
  width: 2px;
  border-radius: 2px;
  background: #d88410;
  box-shadow: 0 0 0 1px rgba(255,255,255,.72);
  text-decoration: none;
  transform: translateX(-50%);
}

.dashboard-theme .coverage-mini-row.is-shortage .production-mini-track > i,
.dashboard-theme .quality-mini-track > i {
  background: linear-gradient(90deg, #d88410 0%, #f59f2f 78%, #ffd398 100%);
}

.dashboard-theme .production-mini-row > strong {
  min-width: 52px;
  overflow: hidden;
  color: #30393e;
  font-size: .62rem;
  font-weight: 850;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .coverage-mini-row.is-shortage > strong {
  color: #c87812;
}

.dashboard-theme .coverage-mini-row.is-surplus > strong {
  color: #11181c;
}

/* Compact view: only the small visual is shown. Full operational detail is
   reserved for the widget modal. */
.dashboard-theme .production-compact-widget:not(.is-widget-maximized) > .production-coverage-legend,
.dashboard-theme .production-compact-widget:not(.is-widget-maximized) > .production-coverage-list,
.dashboard-theme .production-compact-widget:not(.is-widget-maximized) > .production-widget-detail,
.dashboard-theme .production-compact-widget:not(.is-widget-maximized) > .empty-state-card {
  display: none !important;
}

.dashboard-theme .widget-modal-backdrop > .production-compact-widget.is-widget-maximized {
  width: min(var(--widget-modal-width, 1080px), calc(100vw - 52px)) !important;
  height: fit-content !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 52px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.dashboard-theme .widget-modal-backdrop > .production-compact-widget.is-widget-maximized > .card-heading {
  min-height: 0;
  margin-bottom: 12px;
  padding-right: 92px;
}

.dashboard-theme .widget-modal-backdrop > .production-compact-widget.is-widget-maximized > .card-heading > .metric-chip {
  position: static;
  margin-right: 0;
}

.dashboard-theme .widget-modal-backdrop > .production-compact-widget.is-widget-maximized .production-widget-preview {
  display: none !important;
}

.dashboard-theme .widget-modal-backdrop > .production-coverage-widget.is-widget-maximized {
  max-width: 1220px !important;
}

.dashboard-theme .widget-modal-backdrop > .production-coverage-widget.is-widget-maximized .production-coverage-summary {
  position: static;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  padding-right: 0;
}

.dashboard-theme .widget-modal-backdrop > .production-coverage-widget.is-widget-maximized .production-coverage-summary .is-surplus {
  display: inline-flex;
}

.dashboard-theme .widget-modal-backdrop > .production-coverage-widget.is-widget-maximized .production-coverage-legend {
  display: flex !important;
  margin-bottom: 12px;
}

.dashboard-theme .widget-modal-backdrop > .production-coverage-widget.is-widget-maximized .production-coverage-list {
  display: grid !important;
  max-height: min(590px, calc(100dvh - 275px));
  overflow-y: auto;
}

.dashboard-theme .widget-modal-backdrop > .production-ranking-widget.is-widget-maximized {
  max-width: 1060px !important;
}

.dashboard-theme .widget-modal-backdrop > .production-ranking-widget.is-widget-maximized .production-widget-detail {
  display: block !important;
}

.dashboard-theme .widget-modal-backdrop > .production-ranking-widget.is-widget-maximized .production-expanded-chart {
  width: 100%;
  min-height: 320px;
  max-height: min(610px, calc(100dvh - 210px));
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.dashboard-theme .widget-modal-backdrop > .production-ranking-widget.is-widget-maximized .production-expanded-chart canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

.dashboard-theme .widget-modal-backdrop > .production-quality-widget.is-widget-maximized {
  max-width: 1080px !important;
}

.dashboard-theme .widget-modal-backdrop > .production-quality-widget.is-widget-maximized .production-widget-detail {
  display: grid !important;
  gap: 8px;
  max-height: min(620px, calc(100dvh - 215px));
  padding-right: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  align-content: start;
}

.dashboard-theme .widget-modal-backdrop > .production-quality-widget.is-widget-maximized .batch-return-row {
  min-height: 58px;
}

@media (max-width: 1320px) {
  .dashboard-theme .production-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-theme .production-compact-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .production-compact-widget {
    height: auto;
    min-height: 300px;
  }

  .dashboard-theme .production-coverage-widget:not(.is-widget-maximized) .production-coverage-summary {
    position: static;
    display: flex;
    justify-content: flex-start;
    margin-top: 7px;
  }

  .dashboard-theme .widget-modal-backdrop > .production-compact-widget.is-widget-maximized {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
  }
}


/* ========================================================================== */
/* Delidips refinement v21 — denser production overview + reset state         */
/* ========================================================================== */

/* Production has enough vertical room on desktop to expose more of the
   initial ranking instead of stopping after five rows. All three cards share
   the same height so the row reads as one balanced dashboard section. */
@media (min-width: 901px) {
  .dashboard-theme .production-compact-widget {
    height: clamp(430px, 46vh, 490px);
    min-height: 430px;
  }

  .dashboard-theme .production-compact-widget > .card-heading {
    min-height: 88px;
    margin-bottom: 7px;
  }

  .dashboard-theme .production-mini-chart {
    gap: 8px;
    padding-top: 3px;
  }

  .dashboard-theme .production-mini-row {
    min-height: 22px;
  }

  .dashboard-theme .production-mini-track {
    height: 10px;
  }
}

/* A reset action is only meaningful after the user actually hides a widget. */
.dashboard-theme .widget-reset-button:disabled {
  cursor: default;
  opacity: .42;
  box-shadow: none;
}

/* ========================================================================== */
/* Delidips refinement v22 — compact delivery overview + modal detail         */
/* ========================================================================== */

.dashboard-theme .delivery-compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.dashboard-theme .delivery-compact-widget {
  position: relative;
  min-width: 0;
  height: clamp(430px, 46vh, 490px);
  min-height: 430px;
  padding: 16px 17px;
  overflow: hidden;
  border-radius: 20px;
  background: #fbf8f1;
}

.dashboard-theme .delivery-routes-widget {
  grid-column: span 2;
}

.dashboard-theme .delivery-compact-widget > .card-heading {
  position: relative;
  min-height: 88px;
  margin-bottom: 7px;
  padding-right: 88px;
}

.dashboard-theme .delivery-compact-widget > .card-heading > div:first-child {
  min-width: 0;
  max-width: 100%;
}

.dashboard-theme .delivery-compact-widget > .card-heading h2 {
  margin-top: 4px;
  font-size: clamp(.94rem, 1.05vw, 1.10rem);
  line-height: 1.12;
}

.dashboard-theme .delivery-compact-widget > .card-heading .chart-insight {
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: #7a8082;
  font-size: .60rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .delivery-compact-widget > .card-heading > .metric-chip {
  position: absolute;
  top: 0;
  right: 82px;
  min-height: 27px;
  padding: 4px 8px;
  font-size: .60rem;
}

.dashboard-theme .delivery-compact-widget > .card-heading > .widget-control-group {
  position: absolute;
  top: 0;
  right: 0;
  gap: 7px;
  margin-left: 0;
}

.dashboard-theme .delivery-widget-preview {
  display: block;
  min-height: 0;
}

.dashboard-theme .delivery-widget-detail {
  display: none;
}

.dashboard-theme .delivery-mini-chart {
  display: grid;
  gap: 8px;
  min-height: 0;
  padding-top: 3px;
}

.dashboard-theme .delivery-mini-row {
  display: grid;
  grid-template-columns: minmax(94px, .95fr) minmax(90px, 1.42fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  min-height: 22px;
}

.dashboard-theme .delivery-mini-label {
  display: flex;
  min-width: 0;
  gap: 5px;
  align-items: baseline;
  color: #586166;
  font-size: .62rem;
  line-height: 1.1;
  white-space: nowrap;
}

.dashboard-theme .delivery-mini-label b {
  flex: 0 0 auto;
  color: #2d363b;
  font-size: .60rem;
  font-weight: 850;
}

.dashboard-theme .delivery-mini-label em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
}

.dashboard-theme .delivery-mini-track {
  display: block;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e3dc;
}

.dashboard-theme .delivery-mini-track i {
  display: block;
  width: var(--delivery-mini-width);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #11181c 0%, #2b3439 76%, #f59f2f 100%);
}

.dashboard-theme .result-mini-row.is-not-delivered .delivery-mini-track i,
.dashboard-theme .delay-mini-row .delivery-mini-track i,
.dashboard-theme .route-mini-row.is-pending .delivery-mini-track i {
  background: linear-gradient(90deg, #d88410 0%, #f59f2f 78%, #ffd398 100%);
}

.dashboard-theme .result-mini-row.is-returned .delivery-mini-track i {
  background: linear-gradient(90deg, #a94d14, #f59f2f);
}

.dashboard-theme .route-mini-row.is-complete .delivery-mini-track i,
.dashboard-theme .result-mini-row.is-confirmed .delivery-mini-track i {
  background: linear-gradient(90deg, #11181c 0%, #343f45 82%, #f59f2f 100%);
}

.dashboard-theme .delivery-mini-row > strong {
  min-width: 54px;
  overflow: hidden;
  color: #30393e;
  font-size: .62rem;
  font-weight: 850;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .routes-mini-chart .delivery-mini-row {
  grid-template-columns: minmax(130px, .9fr) minmax(160px, 1.8fr) auto;
}

/* Small vertical OTIF chart designed specifically for the initial card. */
.dashboard-theme .delivery-otif-mini-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(32px, 1fr));
  align-items: end;
  gap: 6px;
  height: 285px;
  padding: 8px 3px 2px;
  border-bottom: 1px solid rgba(17, 24, 28, .12);
}

.dashboard-theme .delivery-otif-mini-column {
  display: grid;
  grid-template-rows: 22px 1fr 30px;
  gap: 4px;
  min-width: 0;
  height: 100%;
  text-align: center;
}

.dashboard-theme .delivery-otif-mini-column > strong {
  align-self: center;
  color: #394248;
  font-size: .56rem;
  font-weight: 850;
  white-space: nowrap;
}

.dashboard-theme .delivery-otif-mini-column > span {
  position: relative;
  display: block;
  overflow: hidden;
  min-height: 120px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, rgba(17,24,28,.035), rgba(17,24,28,.075));
}

.dashboard-theme .delivery-otif-mini-column > span > i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: max(5px, var(--delivery-otif-height));
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #f8b85f 0%, #f59f2f 34%, #11181c 100%);
}

.dashboard-theme .delivery-otif-mini-column > em {
  align-self: center;
  overflow: hidden;
  color: #697176;
  font-size: .53rem;
  font-style: normal;
  font-weight: 750;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

/* The compact card exposes only its preview. Existing operational details are
   preserved and become the content of the widget modal. */
.dashboard-theme .delivery-compact-widget:not(.is-widget-maximized) .delivery-widget-detail {
  display: none !important;
}

.dashboard-theme .widget-modal-backdrop > .delivery-compact-widget.is-widget-maximized {
  width: min(var(--widget-modal-width, 1080px), calc(100vw - 52px)) !important;
  height: fit-content !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 52px) !important;
  padding: 18px 20px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.dashboard-theme .widget-modal-backdrop > .delivery-compact-widget.is-widget-maximized > .card-heading {
  min-height: 0;
  margin-bottom: 12px;
  padding-right: 96px;
}

.dashboard-theme .widget-modal-backdrop > .delivery-compact-widget.is-widget-maximized > .card-heading > .metric-chip {
  right: 84px;
}

.dashboard-theme .widget-modal-backdrop > .delivery-compact-widget.is-widget-maximized .delivery-widget-preview {
  display: none !important;
}

.dashboard-theme .widget-modal-backdrop > .delivery-compact-widget.is-widget-maximized .delivery-widget-detail {
  display: block !important;
  min-height: 0;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized {
  max-width: 1220px !important;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-heatmap {
  display: grid !important;
  max-height: min(610px, calc(100dvh - 220px));
  overflow: auto;
}

.dashboard-theme .widget-modal-backdrop > .delivery-result-widget.is-widget-maximized,
.dashboard-theme .widget-modal-backdrop > .delivery-delay-widget.is-widget-maximized {
  max-width: 1080px !important;
}

.dashboard-theme .widget-modal-backdrop > .delivery-result-widget.is-widget-maximized .delivery-result-list,
.dashboard-theme .widget-modal-backdrop > .delivery-delay-widget.is-widget-maximized .delivery-delay-bars {
  max-height: min(610px, calc(100dvh - 220px));
  padding-right: 4px;
  overflow-y: auto;
}

.dashboard-theme .widget-modal-backdrop > .delivery-otif-widget.is-widget-maximized {
  max-width: 1080px !important;
}

.dashboard-theme .widget-modal-backdrop > .delivery-otif-widget.is-widget-maximized .monthly-otif-chart {
  min-height: 360px;
  max-height: min(590px, calc(100dvh - 210px));
}

.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized {
  max-width: 1240px !important;
}

.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .ranking-table-wrap {
  max-height: min(620px, calc(100dvh - 220px));
  overflow: auto;
}

@media (max-width: 1320px) {
  .dashboard-theme .delivery-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .delivery-routes-widget {
    grid-column: span 1;
  }
}

@media (max-width: 900px) {
  .dashboard-theme .delivery-compact-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .delivery-compact-widget {
    height: auto;
    min-height: 330px;
  }

  .dashboard-theme .delivery-routes-widget {
    grid-column: auto;
  }

  .dashboard-theme .widget-modal-backdrop > .delivery-compact-widget.is-widget-maximized {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
  }
}


/* ========================================================================== */
/* Delidips refinement v23 — delivery modal sizing + richer route preview     */
/* ========================================================================== */

/* Cycle-operativo is a five-column heatmap. It needs a genuinely wide modal;
   the previous generic table width (roughly the source card width) forced a
   horizontal scroll and clipped the last columns. */
.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized {
  width: min(var(--widget-modal-width, 1240px), calc(100vw - 44px)) !important;
  max-width: 1240px !important;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-widget-detail {
  overflow: hidden;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-heatmap {
  width: 100%;
  max-height: min(620px, calc(100dvh - 220px));
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-row {
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(142px, .8fr)) minmax(88px, .42fr);
  width: 100%;
  gap: 5px;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-row > span,
.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-row > strong,
.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-row > b {
  padding: 6px 9px;
  border-radius: 10px;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-row > strong {
  gap: 1px;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-row > strong span {
  font-size: .77rem;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-row > strong em,
.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-cell,
.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-detail-button {
  font-size: .72rem;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-cell {
  min-height: 38px;
}

.dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-detail-button {
  min-height: 26px;
  padding: 5px 8px;
}

/* Route cards now expose the operational state as well as the progress count. */
.dashboard-theme .routes-mini-chart .delivery-mini-row {
  grid-template-columns: minmax(138px, .95fr) minmax(180px, 1.65fr) minmax(104px, .62fr);
  gap: 10px;
  align-items: center;
}

.dashboard-theme .route-mini-progress-wrap {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-theme .route-mini-progress-caption {
  overflow: hidden;
  color: #6f777c;
  font-size: .53rem;
  font-weight: 750;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .route-mini-summary {
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.dashboard-theme .route-mini-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  color: #11181c;
  background: rgba(245,159,47,.16);
  box-shadow: inset 0 0 0 1px rgba(216,132,16,.14);
  font-size: .55rem;
  font-weight: 850;
  white-space: nowrap;
}

.dashboard-theme .route-mini-row.is-complete .route-mini-status {
  color: #fff;
  background: #11181c;
  box-shadow: none;
}

.dashboard-theme .route-mini-row.is-partial .route-mini-status {
  color: #6f3f00;
  background: rgba(245,159,47,.24);
}

.dashboard-theme .route-mini-summary em {
  overflow: hidden;
  max-width: 100%;
  color: #7a8082;
  font-size: .53rem;
  font-style: normal;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1240px) {
  .dashboard-theme .routes-mini-chart .delivery-mini-row {
    grid-template-columns: minmax(128px, .95fr) minmax(140px, 1.3fr) minmax(94px, .7fr);
  }
}

@media (max-width: 900px) {
  .dashboard-theme .routes-mini-chart .delivery-mini-row {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 6px 0;
  }

  .dashboard-theme .route-mini-summary {
    justify-items: start;
  }
}

/* Prevent an empty personalization strip from consuming vertical space before
   JavaScript restores saved widget state. */
.dashboard-theme .widget-aggregator[hidden] {
  display: none !important;
}

@media (max-width: 1050px) {
  .dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-heatmap {
    overflow-x: auto;
  }

  .dashboard-theme .widget-modal-backdrop > .delivery-cycle-widget.is-widget-maximized .delivery-cycle-row {
    min-width: 920px;
  }
}


/* ========================================================================== */
/* Delidips refinement v26 — compact Summary cards                            */
/* ========================================================================== */

.dashboard-theme .summary-compact-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-theme .summary-compact-widget {
  position: relative;
  min-width: 0;
  min-height: 320px;
  height: clamp(320px, 38vh, 390px);
  padding: 16px 17px;
  overflow: hidden;
  border-radius: 22px;
}

.dashboard-theme .summary-compact-widget > .card-heading {
  position: relative;
  min-height: 82px;
  margin-bottom: 10px;
  padding-right: 86px;
}

.dashboard-theme .summary-compact-widget > .card-heading h2 {
  margin-top: 4px;
  font-size: clamp(.98rem, 1.06vw, 1.14rem);
  line-height: 1.08;
}

.dashboard-theme .summary-compact-widget > .card-heading .chart-insight {
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: #767d80;
  font-size: .61rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .summary-compact-widget > .card-heading > .metric-chip {
  position: absolute;
  top: 0;
  right: 82px;
  min-height: 27px;
  padding: 4px 8px;
  font-size: .6rem;
}

.dashboard-theme .summary-compact-widget > .card-heading > .widget-control-group {
  position: absolute;
  top: 0;
  right: 0;
  margin-left: 0;
}

.dashboard-theme .summary-compact-widget canvas {
  height: clamp(185px, 22vh, 220px) !important;
}

.dashboard-theme .summary-compact-widget.is-widget-maximized canvas,
.dashboard-theme .widget-modal-backdrop > .summary-compact-widget.is-widget-maximized canvas {
  height: min(360px, calc(100dvh - 260px)) !important;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.dashboard-theme .summary-map-widget .delivery-zone-map {
  min-height: 210px;
  height: clamp(210px, 24vh, 250px);
  border-radius: 18px;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-summary span {
  padding: 8px 10px;
  border: 1px solid rgba(17, 26, 38, 0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.54);
}

.dashboard-theme .summary-map-widget .delivery-zone-map-summary strong {
  display: block;
  color: #7f878a;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-summary b {
  display: block;
  margin-top: 2px;
  color: #16232b;
  font-size: .92rem;
  font-weight: 900;
}

.dashboard-theme .summary-variation-widget .variation-delta-chart {
  margin-top: 2px;
}

.dashboard-theme .summary-variation-widget .variation-explain-list,
.dashboard-theme .summary-variation-widget .variation-reading-note {
  display: none;
}

.dashboard-theme .summary-variation-widget.is-widget-maximized .variation-explain-list,
.dashboard-theme .summary-variation-widget.is-widget-maximized .variation-reading-note,
.dashboard-theme .widget-modal-backdrop > .summary-variation-widget.is-widget-maximized .variation-explain-list,
.dashboard-theme .widget-modal-backdrop > .summary-variation-widget.is-widget-maximized .variation-reading-note {
  display: block;
}

.dashboard-theme .summary-variation-widget .variation-delta-row {
  gap: 10px;
  padding: 9px 0;
}

.dashboard-theme .summary-chart-widget {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .summary-chart-widget canvas,
.dashboard-theme .summary-chart-widget .variation-delta-chart {
  margin-top: auto;
}

.dashboard-theme .summary-compact-widget.is-widget-maximized,
.dashboard-theme .widget-modal-backdrop > .summary-compact-widget.is-widget-maximized {
  height: auto;
  min-height: 0;
}

.dashboard-theme .summary-compact-widget.is-widget-maximized > .card-heading,
.dashboard-theme .widget-modal-backdrop > .summary-compact-widget.is-widget-maximized > .card-heading {
  min-height: 0;
  padding-right: 96px;
}

.dashboard-theme .summary-compact-widget.is-widget-maximized > .card-heading .chart-insight,
.dashboard-theme .widget-modal-backdrop > .summary-compact-widget.is-widget-maximized > .card-heading .chart-insight {
  white-space: normal;
}

.dashboard-theme .summary-map-widget.is-widget-maximized,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized {
  grid-column: 1 / -1;
}

.dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map {
  min-height: 420px;
}

.dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map-summary,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .dashboard-theme .summary-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-theme .summary-compact-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .summary-map-widget .delivery-zone-map-summary,
  .dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map-summary,
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* ========================================================================== */
/* Delidips refinement v27 — summary compact cards & maximized widgets        */
/* ========================================================================== */

.dashboard-theme .summary-compact-grid {
  align-items: stretch;
}

.dashboard-theme .summary-compact-widget {
  min-height: 300px;
  height: clamp(300px, 35vh, 360px);
  padding: 14px 15px 15px;
}

.dashboard-theme .summary-compact-widget > .card-heading {
  min-height: 68px;
  margin-bottom: 8px;
  padding-right: 84px;
}

.dashboard-theme .summary-compact-widget > .card-heading h2 {
  font-size: clamp(.96rem, 1.02vw, 1.12rem);
  line-height: 1.1;
}

.dashboard-theme .summary-compact-widget > .card-heading .chart-insight {
  font-size: .58rem;
}

.dashboard-theme .summary-compact-widget > .card-heading > .metric-chip {
  right: 80px;
  min-height: 25px;
  padding: 4px 8px;
}

.dashboard-theme .summary-chart-widget canvas {
  flex: 1 1 auto;
  width: 100% !important;
  height: clamp(170px, 20vh, 208px) !important;
}

.dashboard-theme .summary-map-widget {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-layout {
  flex: 1 1 auto;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
}

.dashboard-theme .summary-map-widget .delivery-zone-map {
  min-height: 150px;
  height: clamp(150px, 17.5vh, 185px);
}

.dashboard-theme .summary-map-widget .delivery-zone-map-summary {
  gap: 6px;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-summary span {
  min-height: 0;
  padding: 7px 9px;
  border-radius: 12px;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-summary strong {
  font-size: .54rem;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-summary b {
  font-size: .86rem;
}

.dashboard-theme .summary-variation-widget .variation-delta-chart {
  display: grid;
  gap: 4px;
  margin-top: auto;
}

.dashboard-theme .summary-variation-widget .variation-delta-row {
  gap: 8px;
  padding: 6px 0;
}

.dashboard-theme .summary-variation-widget .variation-delta-label strong,
.dashboard-theme .summary-variation-widget .variation-delta-value {
  font-size: .78rem;
}

.dashboard-theme .summary-variation-widget .variation-delta-label span {
  font-size: .62rem;
}

.dashboard-theme .widget-modal-backdrop > .summary-compact-widget.is-widget-maximized {
  max-width: min(var(--widget-modal-width, 1040px), calc(100vw - 42px)) !important;
  max-height: calc(100dvh - 42px) !important;
  padding: 18px 20px !important;
}

.dashboard-theme .widget-modal-backdrop > .summary-compact-widget.is-widget-maximized > .card-heading {
  min-height: 0;
  margin-bottom: 12px;
  padding-right: 96px;
}

.dashboard-theme .widget-modal-backdrop > .summary-compact-widget.is-widget-maximized > .card-heading .chart-insight {
  overflow: visible;
  font-size: .66rem;
  white-space: normal;
}

.dashboard-theme .widget-modal-backdrop > .summary-chart-widget.is-widget-maximized {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .widget-modal-backdrop > .summary-chart-widget.is-widget-maximized canvas {
  flex: 1 1 auto;
  width: 100% !important;
  height: min(470px, calc(100dvh - 210px)) !important;
}

.dashboard-theme .widget-modal-backdrop > .summary-chart-widget.is-widget-maximized.channel-share-card canvas {
  height: min(430px, calc(100dvh - 230px)) !important;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized {
  max-width: min(var(--widget-modal-width, 1140px), calc(100vw - 36px)) !important;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-layout {
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-rows: 1fr;
  gap: 12px;
  align-items: stretch;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map {
  min-height: 500px;
  height: min(540px, calc(100dvh - 230px));
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary span {
  padding: 12px 12px 11px;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary strong {
  font-size: .58rem;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary b {
  font-size: 1rem;
}

.dashboard-theme .widget-modal-backdrop > .summary-variation-widget.is-widget-maximized .variation-delta-chart {
  gap: 6px;
}

.dashboard-theme .widget-modal-backdrop > .summary-variation-widget.is-widget-maximized .variation-delta-row {
  padding: 8px 0;
}

@media (max-width: 1320px) {
  .dashboard-theme .customer-account-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1220px) {
  .dashboard-theme .summary-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 1fr) auto;
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-theme .summary-compact-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .summary-compact-widget {
    height: auto;
    min-height: 290px;
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary {
    grid-template-columns: 1fr;
  }
}


/* ========================================================================== */
/* Delidips refinement v28 — summary map compact preview + modal dimming      */
/* ========================================================================== */

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
  min-height: 286px;
  height: clamp(286px, 31vh, 318px);
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) > .card-heading {
  min-height: 64px;
  margin-bottom: 7px;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-layout {
  display: grid;
  grid-template-rows: auto minmax(118px, 138px);
  gap: 7px;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary {
  order: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary span {
  padding: 6px 8px;
  gap: 2px;
  border-radius: 11px;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary strong {
  font-size: .5rem;
  letter-spacing: .05em;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary b {
  font-size: .8rem;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map {
  min-height: 118px;
  height: clamp(118px, 13.5vh, 138px);
  border-radius: 16px;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-control-attribution {
  display: none;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-bottom.leaflet-left {
  transform: scale(.88);
  transform-origin: left bottom;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-control-zoom {
  transform: scale(.9);
  transform-origin: left top;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-control-zoom a {
  width: 26px;
  height: 26px;
  line-height: 24px;
  font-size: 1rem;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-control-zoom,
.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .delivery-zone-legend {
  box-shadow: 0 10px 24px rgba(6, 18, 22, .08);
}

.widget-modal-backdrop {
  background: rgba(8, 12, 14, .68);
}

body.widget-maximized .dashboard-theme .delivery-zone-map-card:not(.is-widget-maximized) {
  opacity: .14;
  transition: opacity .18s ease;
}

body.widget-maximized .dashboard-theme .delivery-zone-map-card:not(.is-widget-maximized) .delivery-zone-map {
  filter: saturate(.55);
}

@media (max-width: 760px) {
  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* ========================================================================== */
/* Delidips refinement v29 — summary map final compact + backdrop isolation   */
/* ========================================================================== */

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
  min-height: 320px;
  height: clamp(320px, 34vh, 352px);
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) > .card-heading {
  min-height: 62px;
  margin-bottom: 8px;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-layout {
  display: grid;
  grid-template-rows: auto minmax(148px, 1fr);
  gap: 8px;
  align-content: stretch;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary {
  order: -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 50px;
  padding: 7px 10px;
  gap: 2px;
  border-radius: 12px;
  background: rgba(255, 251, 244, 0.95);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82);
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary strong {
  color: #7d878c;
  font-size: .52rem;
  letter-spacing: .05em;
  line-height: 1.1;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary b {
  color: #16232b;
  font-size: .84rem;
  font-weight: 900;
  line-height: 1.05;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map {
  min-height: 148px;
  height: clamp(148px, 16vh, 168px);
  border-radius: 16px;
  position: relative;
  isolation: isolate;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-control-attribution {
  display: none !important;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-top,
.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-bottom {
  z-index: 2;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-control-zoom {
  transform: scale(.82);
  transform-origin: left top;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .leaflet-control-zoom a {
  width: 24px;
  height: 24px;
  line-height: 22px;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map .delivery-zone-legend {
  transform: scale(.82);
  transform-origin: left bottom;
}

body.widget-maximized .dashboard-theme .delivery-zone-map-card:not(.is-widget-maximized) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.widget-maximized .dashboard-theme .delivery-zone-map-card:not(.is-widget-maximized) .delivery-zone-map,
body.widget-maximized .dashboard-theme .delivery-zone-map-card:not(.is-widget-maximized) .delivery-zone-map *,
body.widget-maximized .dashboard-theme .delivery-zone-map-card:not(.is-widget-maximized) .delivery-zone-map-summary {
  visibility: hidden !important;
}

@media (max-width: 760px) {
  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* ========================================================================== */
/* Delidips refinement v30 — taller summary map, cleaner routes, settings UI  */
/* ========================================================================== */

.widget-modal-backdrop {
  z-index: 1000;
}

.success-banner {
  background: rgba(52, 166, 138, .14);
  border-color: rgba(52, 166, 138, .32);
  color: #1d5b4b;
}

.error-banner {
  background: rgba(196, 61, 34, .11);
  border-color: rgba(196, 61, 34, .28);
  color: #8b2f1d;
}

/* Summary map sizing stays with the compact preview refinements above. */

/* ========================================================================== */
/* Summary density override — desktop first-row fit                            */
/* ========================================================================== */

@media (min-width: 1221px) {
  .dashboard-theme .summary-kpi-grid {
    gap: 12px;
    margin-bottom: 14px;
  }

  .dashboard-theme .summary-kpi-grid .kpi-card {
    min-height: 104px;
    padding: 14px 16px;
  }

  .dashboard-theme .summary-kpi-grid .kpi-card > span,
  .dashboard-theme .summary-kpi-grid .kpi-card small {
    font-size: .72rem;
  }

  .dashboard-theme .summary-kpi-grid .kpi-card strong {
    max-width: 100%;
    margin: 10px 0 6px;
    font-size: clamp(1.24rem, 1.75vw, 2rem);
    letter-spacing: -0.06em;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
    grid-row: auto;
    min-height: 300px;
    height: clamp(300px, 30vh, 330px);
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) > .card-heading {
    min-height: 62px;
    margin-bottom: 8px;
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-layout {
    grid-template-rows: auto minmax(148px, 1fr);
    gap: 8px;
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map {
    min-height: 148px;
    height: clamp(148px, 16vh, 168px);
  }
}

body.widget-maximized .dashboard-theme .delivery-zone-map-card:not(.is-widget-maximized) {
  display: none !important;
}

.dashboard-theme .delivery-routes-widget {
  min-height: 472px;
  height: clamp(472px, 48vh, 530px);
}

.dashboard-theme .delivery-routes-widget .delivery-widget-preview {
  display: flex;
  align-items: stretch;
}

.dashboard-theme .routes-mini-chart {
  width: 100%;
  gap: 10px;
  padding-top: 6px;
}

.dashboard-theme .routes-mini-chart .delivery-mini-row {
  grid-template-columns: minmax(170px, 1.05fr) minmax(0, 1.8fr) minmax(102px, .72fr);
  gap: 12px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid rgba(17, 24, 28, .08);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(255,255,255,.68), rgba(250,246,238,.95));
}

.dashboard-theme .routes-mini-chart .delivery-mini-label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 6px;
  min-width: 0;
  white-space: normal;
}

.dashboard-theme .routes-mini-chart .delivery-mini-label b {
  margin-top: 1px;
  font-size: .66rem;
}

.dashboard-theme .routes-mini-chart .delivery-mini-label em {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
}

.dashboard-theme .route-mini-progress-wrap {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.dashboard-theme .routes-mini-chart .delivery-mini-track {
  height: 12px;
}

.dashboard-theme .route-mini-progress-caption {
  overflow: hidden;
  color: #6b7276;
  font-size: .59rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .route-mini-summary {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 0;
  text-align: right;
}

.dashboard-theme .route-mini-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(245, 159, 47, .12);
  color: #7c4d0b;
  font-size: .60rem;
  font-weight: 850;
  line-height: 1;
}

.dashboard-theme .route-mini-row.is-complete .route-mini-status {
  background: rgba(30, 119, 96, .12);
  color: #1d5b4b;
}

.dashboard-theme .route-mini-row.is-partial .route-mini-status {
  background: rgba(245, 159, 47, .15);
  color: #7c4d0b;
}

.dashboard-theme .route-mini-row.is-pending .route-mini-status {
  background: rgba(17, 24, 28, .08);
  color: #263238;
}

.dashboard-theme .route-mini-summary em {
  color: #6e767b;
  font-size: .59rem;
  font-style: normal;
  font-weight: 700;
}

.configuration-launcher {
  width: calc(100% - 10px);
  border: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
}

.configuration-launcher.is-disabled {
  opacity: .55;
  cursor: not-allowed;
}

.settings-modal-open {
  overflow: hidden;
}

.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 16, 18, .58);
}

.settings-modal-card {
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px;
  background: #fbf8f1;
  box-shadow: 0 32px 90px rgba(7, 10, 12, .33);
}

.settings-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.settings-modal-header h2 {
  margin: 5px 0 4px;
  color: #11181c;
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  font-weight: 900;
}

.settings-modal-header p {
  margin: 0;
  color: #6f767b;
  font-size: .92rem;
}

.settings-close-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(17,24,28,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  color: #213038;
  font-size: 1.6rem;
  line-height: 1;
}

.settings-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.settings-summary-card,
.settings-user-card {
  border: 1px solid rgba(17,24,28,.08);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.74), rgba(251,248,241,.98));
  box-shadow: 0 14px 30px rgba(12, 20, 24, .05);
}

.settings-summary-card {
  padding: 16px 18px;
}

.settings-summary-card span {
  display: block;
  margin-bottom: 8px;
  color: #7a8085;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.settings-summary-card strong {
  display: block;
  color: #11181c;
  font-size: 1.55rem;
  font-weight: 900;
}

.settings-summary-card small {
  display: block;
  margin-top: 6px;
  color: #6f767b;
  font-size: .76rem;
  line-height: 1.35;
}

.settings-users-section {
  margin-top: 18px;
}

.settings-section-heading h3 {
  margin: 0 0 4px;
  color: #11181c;
  font-size: 1.05rem;
  font-weight: 900;
}

.settings-section-heading p {
  margin: 0 0 12px;
  color: #6f767b;
  font-size: .82rem;
}

.settings-user-list {
  display: grid;
  gap: 14px;
}

.settings-user-card {
  padding: 16px 18px;
}

.settings-user-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.settings-user-card-head h4 {
  margin: 0 0 4px;
  color: #11181c;
  font-size: 1rem;
  font-weight: 900;
}

.settings-user-card-head p {
  margin: 0;
  color: #6f767b;
  font-size: .78rem;
}

.settings-badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.settings-user-form,
.settings-create-form {
  display: grid;
  gap: 12px;
}

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

.settings-form-grid label,
.settings-create-form label {
  display: grid;
  gap: 6px;
}

.settings-form-grid label > span,
.settings-create-form label > span {
  color: #556066;
  font-size: .72rem;
  font-weight: 800;
}

.settings-form-grid input,
.settings-create-form input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(17,24,28,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.9);
  color: #11181c;
}

.settings-permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.settings-permission-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(17,24,28,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.84);
  color: #223038;
  font-size: .78rem;
  font-weight: 700;
}

.settings-permission-chip.is-active {
  border-color: rgba(245,159,47,.35);
  background: rgba(245,159,47,.09);
}

.settings-user-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.settings-delete-form {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.delete-user-button {
  color: #8b2f1d;
}

@media (max-width: 1500px) {
  .dashboard-theme .customer-account-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1220px) {
  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
    min-height: 560px;
    height: auto;
  }
}

@media (max-width: 980px) {
  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
    grid-row: auto;
    min-height: 520px;
  }

  .settings-summary-grid,
  .settings-permission-grid,
  .settings-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
    min-height: 460px;
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-summary,
  .dashboard-theme .routes-mini-chart .delivery-mini-row,
  .settings-summary-grid,
  .settings-permission-grid,
  .settings-form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .routes-mini-chart .delivery-mini-row {
    justify-items: stretch;
  }

  .settings-modal-card {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
    padding: 18px;
  }
}

/* ========================================================================== */
/* Delidips refinement v31 — production monitor single header                 */
/* ========================================================================== */

.dashboard-theme .production-monitor-main-hero {
  min-height: 118px;
}

.dashboard-theme .production-monitor-main-hero .hero-copy {
  padding-right: 285px;
}

.dashboard-theme .production-monitor-main-status {
  position: absolute;
  z-index: 4;
  right: 18px;
  bottom: 17px;
  min-width: 220px;
  max-width: 250px;
  padding: 9px 12px;
  border-color: rgba(245, 159, 47, .26);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(245,159,47,.08)),
    rgba(5, 10, 12, .44);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 10px 26px rgba(0,0,0,.14);
  backdrop-filter: none;
}

.dashboard-theme .production-monitor-main-status .production-live-dot {
  background: #f59f2f;
  box-shadow: 0 0 0 5px rgba(245,159,47,.14);
}

.dashboard-theme .production-monitor-main-status strong {
  color: #fff;
  font-size: .70rem;
  font-weight: 850;
}

.dashboard-theme .production-monitor-main-status [data-production-monitor-status-detail] {
  color: rgba(255,255,255,.68);
  font-size: .64rem;
}

.dashboard-theme .production-monitor-main-status.is-error .production-live-dot {
  background: #e76b4d;
  box-shadow: 0 0 0 5px rgba(231,107,77,.14);
}

.dashboard-theme .production-monitor-shell {
  margin-top: 12px;
}

@media (max-width: 900px) {
  .dashboard-theme .production-monitor-main-hero {
    min-height: 150px;
    padding-bottom: 58px;
  }

  .dashboard-theme .production-monitor-main-hero .hero-copy {
    padding-right: 90px;
  }

  .dashboard-theme .production-monitor-main-status {
    left: 18px;
    right: 18px;
    bottom: 12px;
    min-width: 0;
    max-width: none;
  }
}


/* ========================================================================== */
/* Delidips refinement v33 — configuration as a full dashboard section       */
/* ========================================================================== */

.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 54px;
  margin-top: 8px;
  padding: 7px 3px 6px;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.18);
  border-radius: 0 0 17px 17px;
  color: rgba(250,247,239,.82);
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: .56rem;
  font-weight: 850;
  line-height: 1.08;
  text-align: center;
  cursor: pointer;
  appearance: none;
}

.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher.is-active {
  border-top-color: transparent;
  border-radius: 17px;
  color: #11181c;
  background: #faf7ef;
}

.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher .ui-icon {
  width: 18px;
  height: 18px;
}

.configuration-page-shell {
  display: grid;
  gap: 16px;
  padding-bottom: 26px;
}

.configuration-page-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(17,24,28,.08);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.78), rgba(250,246,238,.96));
}

.configuration-page-intro h2 {
  margin: 4px 0 5px;
  color: #11181c;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 900;
  letter-spacing: -.03em;
}

.configuration-page-intro p {
  margin: 0;
  max-width: 760px;
  color: #6f767b;
  font-size: .86rem;
  line-height: 1.45;
}

.configuration-admin-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #fff;
  background: #11181c;
  font-size: .68rem;
  font-weight: 850;
  white-space: nowrap;
}

.configuration-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.configuration-summary-card {
  min-height: 132px;
}

.configuration-summary-card.is-primary {
  color: #fff;
  background: linear-gradient(135deg, #11181c 0%, #1e2b31 76%, #3c3326 100%);
}

.configuration-summary-card.is-primary span,
.configuration-summary-card.is-primary small {
  color: rgba(255,255,255,.72);
}

.configuration-summary-card.is-primary strong {
  color: #fff;
}

.configuration-users-panel {
  padding: 18px;
  border: 1px solid rgba(17,24,28,.08);
  border-radius: 22px;
  background: #faf7f0;
}

.configuration-section-heading {
  margin-bottom: 14px;
}

.configuration-section-heading .eyebrow {
  margin-bottom: 6px;
}

.configuration-section-heading h3 {
  margin: 0 0 4px;
  color: #11181c;
  font-size: 1.12rem;
  font-weight: 900;
}

.configuration-section-heading p {
  margin: 0;
  color: #6f767b;
  font-size: .80rem;
}

.configuration-user-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.configuration-user-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.configuration-user-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.configuration-user-avatar {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #11181c, #2d3c42);
  font-size: .92rem;
  font-weight: 900;
}

.configuration-user-card .settings-user-card-head {
  margin-bottom: 0;
}

.configuration-user-form {
  gap: 11px;
}

.configuration-permission-title {
  display: grid;
  gap: 2px;
  padding-top: 2px;
}

.configuration-permission-title strong {
  color: #263238;
  font-size: .72rem;
  font-weight: 900;
}

.configuration-permission-title span {
  color: #7b8387;
  font-size: .64rem;
  line-height: 1.35;
}

.configuration-permission-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.configuration-permission-grid .settings-permission-chip {
  min-height: 40px;
  padding: 8px 9px;
  font-size: .68rem;
}

.configuration-permission-grid .settings-permission-chip .ui-icon {
  width: 14px;
  height: 14px;
  color: #5f676c;
}

.configuration-permission-grid .settings-permission-chip.is-active .ui-icon {
  color: #d88410;
}

.configuration-user-actions {
  justify-content: flex-start;
}

.configuration-create-panel {
  background: linear-gradient(180deg, rgba(255,255,255,.7), rgba(250,247,240,.98));
}

.configuration-create-form {
  gap: 14px;
}

.configuration-create-fields {
  max-width: 720px;
}

@media (max-width: 1180px) {
  .configuration-user-list {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 820px) {
  .configuration-page-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .configuration-summary-grid,
  .configuration-permission-grid,
  .configuration-create-fields {
    grid-template-columns: 1fr;
  }
}


/* ========================================================================== */
/* Delidips refinement v34 — single-panel user ABM / permissions workflow     */
/* ========================================================================== */

.configuration-page-shell-compact {
  display: grid;
  gap: 12px;
}

.configuration-page-intro-compact {
  min-height: 0;
  padding: 14px 18px;
  border-radius: 18px;
}

.configuration-page-intro-compact h2 {
  margin: 3px 0 2px;
  font-size: 1.15rem;
}

.configuration-page-intro-compact p {
  max-width: 820px;
  margin: 0;
  font-size: .78rem;
  line-height: 1.35;
}

.configuration-page-intro-compact .configuration-admin-pill {
  min-height: 30px;
  padding: 5px 10px;
  font-size: .62rem;
}

.configuration-abm-panel {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(17,24,28,.08);
  border-radius: 22px;
  background: rgba(251,248,241,.96);
}

.configuration-abm-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(17,24,28,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.66), rgba(249,245,237,.72));
}

.configuration-user-selector {
  display: grid;
  gap: 5px;
  min-width: min(390px, 55%);
}

.configuration-user-selector > span {
  color: #677176;
  font-size: .66rem;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.configuration-user-selector select {
  width: 100%;
  min-height: 40px;
  padding: 8px 36px 8px 12px;
  border: 1px solid rgba(17,24,28,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  color: #11181c;
  font-size: .82rem;
  font-weight: 800;
}

.configuration-new-user-button {
  min-height: 44px;
  white-space: nowrap;
}

.configuration-abm-editor {
  position: relative;
  padding: 16px;
}

.configuration-abm-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.configuration-abm-heading h3 {
  margin: 3px 0 2px;
  color: #11181c;
  font-size: 1.05rem;
  font-weight: 900;
}

.configuration-abm-heading p {
  margin: 0;
  color: #70787c;
  font-size: .76rem;
}

.configuration-user-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid rgba(17,24,28,.08);
  border-radius: 999px;
  background: rgba(17,24,28,.06);
  color: #435057;
  font-size: .62rem;
  font-weight: 850;
  white-space: nowrap;
}

.configuration-user-state.is-admin {
  border-color: rgba(245,159,47,.24);
  background: rgba(245,159,47,.12);
  color: #7c4a00;
}

.configuration-single-user-form {
  display: grid;
  gap: 14px;
}

.configuration-user-fields {
  grid-template-columns: minmax(220px, .8fr) minmax(260px, 1fr);
  max-width: 820px;
}

.configuration-user-fields input[readonly] {
  background: rgba(17,24,28,.045);
  color: #677176;
}

.configuration-permissions-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding-top: 2px;
}

.configuration-permissions-header > div:first-child {
  display: grid;
  gap: 2px;
}

.configuration-permissions-header strong {
  color: #11181c;
  font-size: .86rem;
  font-weight: 900;
}

.configuration-permissions-header span {
  color: #70787c;
  font-size: .7rem;
}

.configuration-permission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.configuration-permission-actions .ghost-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: .63rem;
}

.configuration-permissions-groups {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, .85fr);
  gap: 12px;
}

.configuration-permission-group {
  padding: 11px;
  border: 1px solid rgba(17,24,28,.075);
  border-radius: 16px;
  background: rgba(255,255,255,.46);
}

.configuration-permission-group-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.configuration-permission-group-heading > span {
  color: #11181c;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.configuration-permission-group-heading small {
  color: #82898c;
  font-size: .6rem;
}

.configuration-permission-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.configuration-permission-grid-compact.is-monitor-grid {
  grid-template-columns: 1fr;
}

.configuration-permission-grid-compact .settings-permission-chip {
  min-height: 38px;
  padding: 7px 9px;
  border-radius: 11px;
  font-size: .69rem;
}

.configuration-permission-grid-compact .settings-permission-chip .ui-icon {
  width: 16px;
  height: 16px;
  font-size: .86rem;
}

.configuration-abm-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(17,24,28,.08);
}

.configuration-form-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.configuration-security-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6c757a;
  font-size: .64rem;
}

.configuration-security-note > span {
  color: #f59f2f;
  font-size: .56rem;
}

.configuration-delete-inline {
  display: flex;
  margin: 0;
}

.configuration-delete-inline[hidden] {
  display: none !important;
}

.configuration-form-actions > .slim-button,
.configuration-delete-inline .delete-user-button {
  min-height: 44px;
  padding: 11px 20px;
  font: inherit;
}

@media (max-width: 1100px) {
  .configuration-permissions-groups {
    grid-template-columns: 1fr;
  }

  .configuration-permission-grid-compact.is-monitor-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .configuration-abm-toolbar,
  .configuration-permissions-header,
  .configuration-abm-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .configuration-user-selector {
    min-width: 0;
    width: 100%;
  }

  .configuration-new-user-button {
    width: 100%;
  }

  .configuration-user-fields {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .configuration-permission-grid-compact,
  .configuration-permission-grid-compact.is-monitor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .configuration-form-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .configuration-delete-inline,
  .configuration-form-actions > .slim-button {
    width: 100%;
  }

  .configuration-delete-inline .delete-user-button,
  .configuration-form-actions > .slim-button {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .configuration-permission-grid-compact,
  .configuration-permission-grid-compact.is-monitor-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================================== */
/* Delidips refinement v32 — readable geographic delivery-zone map            */
/* ========================================================================== */

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
  grid-column: span 2;
  min-height: 400px;
  height: clamp(400px, 44vh, 450px);
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-layout {
  display: grid;
  grid-template-areas:
    "summary"
    "key"
    "map";
  grid-template-rows: auto auto minmax(240px, 1fr);
  gap: 9px;
  min-height: 0;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-summary {
  grid-area: summary;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-key {
  grid-area: key;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 2px 4px;
  color: #5f696d;
  font-size: .61rem;
  font-weight: 750;
  line-height: 1.2;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-key > strong {
  color: #17252d;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-key > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-key i {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(17, 24, 28, .12);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.42);
}

.dashboard-theme .summary-map-widget .delivery-zone-map-key i.is-low {
  background: #34a68a;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-key i.is-medium {
  background: #f5b14d;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-key i.is-high {
  background: #f47a35;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-key i.is-very-high {
  background: #c43d22;
}

.dashboard-theme .summary-map-widget .delivery-zone-map-key > small {
  margin-left: auto;
  color: #7a8386;
  font-size: .58rem;
  font-weight: 650;
  text-align: right;
}

.dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map {
  grid-area: map;
  min-height: 240px;
  height: 100%;
  border: 1px solid rgba(17, 24, 28, .1);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.48);
}

.dashboard-theme .summary-map-widget .delivery-zone-map .delivery-zone-legend {
  display: none;
}

.dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map-layout,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-layout {
  grid-template-areas:
    "map summary"
    "map key";
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-rows: auto 1fr;
}

.dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map {
  grid-area: map;
}

.dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map-key,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key {
  align-content: start;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 6px 4px;
}

.dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map-key > strong,
.dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map-key > small,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key > strong,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key > small {
  width: 100%;
  margin-left: 0;
  text-align: left;
}

@media (max-width: 1500px) {
  .dashboard-theme .customer-account-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1220px) {
  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map-layout,
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-layout {
    grid-template-areas:
      "summary"
      "key"
      "map";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(300px, 1fr);
  }

  .dashboard-theme .summary-map-widget.is-widget-maximized .delivery-zone-map-key,
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key {
    align-items: center;
    padding: 2px 4px;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
    grid-column: auto;
    min-height: 480px;
    height: auto;
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-layout {
    grid-template-rows: auto auto minmax(280px, 1fr);
  }

  .dashboard-theme .summary-map-widget .delivery-zone-map-key {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .dashboard-theme .summary-map-widget .delivery-zone-map-key > strong,
  .dashboard-theme .summary-map-widget .delivery-zone-map-key > small {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map {
    min-height: 280px;
  }
}

/* ========================================================================== */
/* Delivery-zone map modal — stable Leaflet canvas and readable split view    */
/* ========================================================================== */

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-layout {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  height: min(620px, calc(100dvh - 190px));
  grid-template-areas:
    "map summary"
    "map key";
  grid-template-columns: minmax(0, 1fr) 304px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: stretch;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map {
  grid-area: map;
  width: 100%;
  height: 100% !important;
  min-height: 0;
  isolation: isolate;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary {
  grid-area: summary;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
  min-width: 0;
  overflow: auto;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key {
  grid-area: key;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  padding: 14px;
  border: 1px solid rgba(17, 37, 45, .12);
  border-radius: 16px;
  background: rgba(255, 250, 241, .92);
  box-shadow: 0 10px 24px rgba(18, 35, 42, .08);
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key > strong,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key > small {
  grid-column: 1 / -1;
  width: auto;
  margin-left: 0;
  text-align: left;
}

.dashboard-theme .summary-map-widget .delivery-zone-map .delivery-zone-legend {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid rgba(17, 37, 45, .15);
  border-radius: 12px;
  background: rgba(255, 250, 241, .94);
  box-shadow: 0 8px 20px rgba(18, 35, 42, .12);
  color: #394850;
  font-size: .68rem;
  font-weight: 750;
  line-height: 1.1;
}

.dashboard-theme .summary-map-widget .delivery-zone-map .delivery-zone-legend strong {
  color: #17252d;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dashboard-theme .summary-map-widget .delivery-zone-map .delivery-zone-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dashboard-theme .summary-map-widget .delivery-zone-map .delivery-zone-legend i {
  width: 11px;
  height: 11px;
  border: 1px solid rgba(17, 37, 45, .14);
  border-radius: 3px;
}

@media (max-width: 980px) {
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-layout {
    height: auto;
    grid-template-areas:
      "summary"
      "key"
      "map";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(340px, 1fr);
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map {
    height: min(520px, calc(100dvh - 320px)) !important;
    min-height: 340px;
  }
}

@media (max-width: 620px) {
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary,
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map {
    height: 340px !important;
    min-height: 340px;
  }
}

/* Return-reason dialogs are reparented to body while their widget is maximized.
   Keep this scoped layer above that widget's overlay without changing other dialogs. */
body.widget-maximized .return-reasons-backdrop {
  z-index: 1001;
}

/* ========================================================================== */
/* Delivery-zone map v33 — tall overview and contained modal Leaflet panes    */
/* ========================================================================== */

/* At the three-column desktop breakpoint the map is a portrait overview: it
   owns one grid track and spans the two card rows beside it. Two- and one-
   column layouts retain their existing full-width / stacked fallbacks. */
@media (min-width: 1221px) {
  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) {
    grid-column: span 1;
    grid-row: span 2;
    min-height: 640px;
    height: auto;
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map-layout {
    grid-template-rows: auto auto minmax(360px, 1fr);
  }

  .dashboard-theme .summary-map-widget:not(.is-widget-maximized) .delivery-zone-map {
    min-height: 360px;
  }
}

/* Leaflet layers carry high z-index values. The map host must therefore be a
   paint-contained stacking context; geometry checks alone cannot prevent a
   stale map-pane transform from painting over its card siblings after a move. */
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized {
  display: flex !important;
  flex-direction: column;
  height: min(680px, calc(100dvh - 48px)) !important;
  max-height: calc(100dvh - 48px) !important;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized > .card-heading {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: hidden;
  grid-template-areas:
    "map summary"
    "map key";
  grid-template-columns: minmax(0, 1fr) 304px;
  grid-template-rows: minmax(0, 1fr) auto;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map {
  position: relative;
  z-index: 0;
  min-height: 0;
  height: 100% !important;
  overflow: hidden;
  contain: paint;
  isolation: isolate;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map .leaflet-container,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map .leaflet-pane {
  max-width: 100%;
  max-height: 100%;
}

.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary,
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

/* The details-panel key is the single source of truth in the maximized view;
   keep Leaflet's compact-preview legend out of the modal. */
.dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map .delivery-zone-legend {
  display: none;
}

@media (max-width: 980px) {
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized {
    height: calc(100dvh - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-layout {
    flex: 0 0 auto;
    overflow: visible;
    grid-template-areas:
      "summary"
      "key"
      "map";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map {
    height: clamp(250px, 38dvh, 340px) !important;
    min-height: 250px;
  }
}

@media (max-width: 620px) {
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-summary,
  .dashboard-theme .widget-modal-backdrop > .summary-map-widget.is-widget-maximized .delivery-zone-map-key {
    grid-template-columns: 1fr;
  }
}

/* ========================================================================== */
/* Delidips refinement v12 — compact traceability + real page scrolling       */
/* ========================================================================== */

/* Traceability is the only Sales tab whose result height is data-driven.
   The other Sales tabs intentionally use a fixed desktop workspace, but that
   model clipped long document histories because body/content-wrap were locked
   to the viewport. When this tab is active, restore natural vertical scroll. */
@media (min-width: 901px) and (min-height: 760px) {
  body.dashboard-theme.sales-traceability-active:not(.widget-maximized) {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.dashboard-theme.sales-traceability-active .app-shell:has(.sales-tabbed-shell) {
    height: auto;
    min-height: 100dvh;
    padding-bottom: 28px;
    overflow: visible;
  }

  body.dashboard-theme.sales-traceability-active .content-wrap:has(.sales-tabbed-shell) {
    height: auto;
    min-height: calc(100dvh - 36px);
    overflow: visible;
  }

  body.dashboard-theme.sales-traceability-active .content-wrap:has(.sales-tabbed-shell) .sales-tabbed-shell {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  body.dashboard-theme.sales-traceability-active .sales-section-panel.is-active {
    height: auto !important;
    min-height: 0;
    overflow: visible;
  }

  /* Free a little more of the first viewport without changing the visual
     language used by the other sales sections. */
  body.dashboard-theme.sales-traceability-active .sales-fixed-kpis {
    gap: 10px;
    margin-bottom: 8px;
  }

  body.dashboard-theme.sales-traceability-active .sales-overview-kpi {
    min-height: 96px;
    padding: 11px 14px;
  }

  body.dashboard-theme.sales-traceability-active .sales-overview-kpi > strong {
    margin: 8px 0 5px;
    font-size: clamp(1.42rem, 2vw, 1.85rem);
  }
}

/* Denser traceability card: same palette, borders and hierarchy, with less
   unused vertical space above the actual document trail. */
.dashboard-theme .sales-traceability-card {
  padding: clamp(14px, 1.5vw, 20px);
  border-radius: 16px;
}

.dashboard-theme .sales-traceability-heading {
  gap: 14px;
}

.dashboard-theme .sales-traceability-heading h2 {
  margin: 2px 0;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.08;
}

.dashboard-theme .sales-traceability-heading p {
  font-size: .78rem;
  line-height: 1.3;
}

.dashboard-theme .sales-traceability-legend {
  font-size: .68rem;
}

.dashboard-theme .sales-traceability-search {
  gap: 9px;
  margin: 14px 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
}

.dashboard-theme .sales-traceability-search label {
  gap: 4px;
  font-size: .69rem;
}

.dashboard-theme .sales-traceability-search input,
.dashboard-theme .sales-traceability-search select,
.dashboard-theme .sales-traceability-search button {
  min-height: 36px;
}

.dashboard-theme .sales-traceability-search input,
.dashboard-theme .sales-traceability-search select {
  padding: 0 9px;
  border-radius: 8px;
}

.dashboard-theme .sales-traceability-search button {
  padding: 0 13px;
  border-radius: 8px;
}

.dashboard-theme .sales-traceability-state {
  min-height: 108px;
  padding: 16px;
  border-radius: 12px;
}

.dashboard-theme .sales-traceability-flow {
  gap: 12px;
  padding: 4px 2px 10px;
}

.dashboard-theme .sales-traceability-result-heading {
  margin-bottom: 0;
  font-size: .88rem;
}

.dashboard-theme .sales-traceability-stage {
  gap: 7px;
}

.dashboard-theme .sales-traceability-stage h3 {
  margin-bottom: 0;
  font-size: .68rem;
}

.dashboard-theme .sales-traceability-document {
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 5px 14px rgb(39 68 53 / 6%);
}

.dashboard-theme .sales-traceability-document header strong {
  font-size: .79rem;
}

.dashboard-theme .sales-traceability-document p,
.dashboard-theme .sales-traceability-observation {
  margin: 6px 0;
}

.dashboard-theme .sales-traceability-relation-label {
  margin-top: 6px;
}

.dashboard-theme .sales-traceability-origin-details {
  margin: 5px 0;
}

.dashboard-theme .sales-traceability-origin-details > summary {
  min-height: 27px;
  padding: 4px 6px;
  border-radius: 7px;
  font-size: .61rem;
}

.dashboard-theme .sales-traceability-origin-details .sales-traceability-relations {
  max-height: 205px;
  margin-top: 4px;
}

.dashboard-theme .sales-traceability-relations {
  gap: 4px;
  margin: 4px 0 6px;
}

.dashboard-theme .sales-traceability-relations li {
  padding: 5px 6px;
  border-radius: 7px;
}

.dashboard-theme .sales-traceability-document summary {
  font-size: .68rem;
}

.dashboard-theme .sales-traceability-lines {
  gap: 5px;
  margin-top: 6px;
}

.dashboard-theme .sales-traceability-lines > div {
  padding-top: 5px;
}

.dashboard-theme .sales-traceability-group {
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
}

@media (max-width: 900px), (max-height: 759px) {
  .dashboard-theme .sales-traceability-card {
    padding: 14px;
  }

  .dashboard-theme .sales-traceability-search {
    margin: 12px 0 14px;
  }
}


/* Traceability refinement v3 — shorter header/search band + stage icons. */
.dashboard-theme .sales-traceability-heading-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-theme .sales-traceability-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
}

.dashboard-theme .sales-traceability-heading-row p {
  margin: 0;
}

.dashboard-theme .sales-traceability-heading .eyebrow {
  margin-bottom: 0;
}

.dashboard-theme .sales-traceability-search {
  margin: 10px 0 14px;
  padding: 8px 10px;
}

.dashboard-theme .sales-traceability-search label {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.dashboard-theme .sales-traceability-search label > span {
  color: #52645a;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-search input,
.dashboard-theme .sales-traceability-search select,
.dashboard-theme .sales-traceability-search button {
  min-height: 34px;
}

.dashboard-theme .sales-traceability-search button {
  align-self: stretch;
}

.dashboard-theme .sales-traceability-state {
  min-height: 88px;
  padding: 14px 16px;
}

.dashboard-theme .sales-traceability-stage h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-theme .sales-traceability-stage-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #d9e6dd;
  background: #f6faf7;
  color: #426356;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 70%);
}

.dashboard-theme .sales-traceability-stage-icon svg {
  width: 12px;
  height: 12px;
  display: block;
}

@media (max-width: 980px) {
  .dashboard-theme .sales-traceability-heading-row {
    display: grid;
    gap: 4px;
  }

  .dashboard-theme .sales-traceability-search label {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 720px) {
  .dashboard-theme .sales-traceability-search {
    padding: 10px;
  }
}


/* Traceability refinement v4 — in-canvas association lines replacing the
   separate summary blocks at the bottom. */
.dashboard-theme .sales-traceability-flow {
  position: relative;
  isolation: isolate;
}

.dashboard-theme .sales-traceability-result-heading,
.dashboard-theme .sales-traceability-truncation,
.dashboard-theme .sales-traceability-stage {
  position: relative;
  z-index: 2;
}

.dashboard-theme .sales-traceability-association-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}

.dashboard-theme .sales-traceability-association-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .68;
}

.dashboard-theme .sales-traceability-document {
  position: relative;
  z-index: 3;
}

.dashboard-theme .sales-traceability-document.has-association {
  border-left-color: var(--association-color, #739484);
  background-image: linear-gradient(180deg, var(--association-soft, #f7faf8), #fff 42%);
}

.dashboard-theme .sales-traceability-document.is-association-root {
  box-shadow: 0 0 0 1px var(--association-color, #739484), 0 5px 14px rgb(39 68 53 / 6%);
}

.dashboard-theme .sales-traceability-association-marker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--association-color, #739484);
  background: var(--association-soft, #f7faf8);
  color: #325043;
  font-size: .6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .02em;
}

.dashboard-theme .sales-traceability-association-marker::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--association-color, #739484);
  box-shadow: 0 0 0 2px rgb(255 255 255 / 80%);
}

.dashboard-theme .sales-traceability-association-marker.is-root::after {
  content: '↗';
  font-size: .64rem;
  color: var(--association-color, #739484);
}

@media (max-width: 900px) {
  .dashboard-theme .sales-traceability-association-overlay {
    display: none;
  }
}


/* Traceability refinement v5 — collapsed cards by default + focused
   associations only when the user highlights one group. */
.dashboard-theme .sales-traceability-flow {
  grid-template-columns: repeat(4, minmax(176px, 1fr));
  gap: 10px;
}

.dashboard-theme .sales-traceability-stage {
  gap: 6px;
}

.dashboard-theme .sales-traceability-document {
  padding: 9px 10px;
}

.dashboard-theme .sales-traceability-document header {
  gap: 8px;
}

.dashboard-theme .sales-traceability-document-heading {
  min-width: 0;
}

.dashboard-theme .sales-traceability-document header strong {
  display: block;
  font-size: .76rem;
  line-height: 1.18;
  word-break: break-word;
}

.dashboard-theme .sales-traceability-document-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.dashboard-theme .sales-traceability-document-actions .sales-traceability-scan-action svg,
.dashboard-theme .sales-traceability-document-actions .sales-traceability-scan-unavailable svg {
  display: block;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
}

.dashboard-theme .sales-traceability-card-toggle {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #d6e2db;
  border-radius: 999px;
  background: #f7faf8;
  color: #355444;
  font-size: .88rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.dashboard-theme .sales-traceability-card-toggle:hover {
  background: #eef5f0;
}

.dashboard-theme .sales-traceability-card-toggle:focus-visible {
  outline: 2px solid rgb(42 128 86 / 28%);
  outline-offset: 2px;
}

.dashboard-theme .sales-traceability-document-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.dashboard-theme .sales-traceability-document.is-collapsed .sales-traceability-document-body {
  display: none;
}

.dashboard-theme .sales-traceability-document.is-collapsed {
  padding-bottom: 8px;
}

.dashboard-theme .sales-traceability-document.is-expanded {
  box-shadow: 0 0 0 1px rgb(42 128 86 / 14%), 0 8px 18px rgb(39 68 53 / 8%);
}

.dashboard-theme .sales-traceability-association-overlay {
  display: block;
}

.dashboard-theme .sales-traceability-association-line {
  opacity: 0;
  stroke-width: 2.2;
  transition: opacity .18s ease, stroke-width .18s ease;
}

.dashboard-theme .sales-traceability-association-line.is-active {
  opacity: .92;
  stroke-width: 2.8;
}

.dashboard-theme .sales-traceability-association-marker {
  appearance: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}

.dashboard-theme .sales-traceability-association-marker:hover,
.dashboard-theme .sales-traceability-association-marker.is-active {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px var(--association-color, #739484);
}

.dashboard-theme .sales-traceability-document.is-association-active {
  opacity: 1;
  box-shadow: 0 0 0 1px var(--association-color, #739484), 0 8px 20px rgb(39 68 53 / 10%);
}

.dashboard-theme .sales-traceability-document.is-association-muted {
  opacity: .7;
}

.dashboard-theme .sales-traceability-document.has-association {
  background-image: none;
}

.dashboard-theme .sales-traceability-document.is-collapsed.has-association {
  background-image: linear-gradient(180deg, var(--association-soft, #f8fbf9), #fff 70%);
}

@media (max-width: 1200px) {
  .dashboard-theme .sales-traceability-flow {
    grid-template-columns: repeat(4, minmax(188px, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-theme .sales-traceability-flow {
    grid-template-columns: repeat(4, minmax(220px, 76vw));
  }

  .dashboard-theme .sales-traceability-association-overlay {
    display: none;
  }
}


/* Traceability refinement v6 — hover cards to reveal arrows + full flow
   from pedido to remito to factura, with narrower columns and larger gutters. */
.dashboard-theme .sales-traceability-flow {
  grid-template-columns:
    minmax(158px, 0.8fr)
    minmax(158px, 0.8fr)
    minmax(170px, 0.88fr)
    minmax(170px, 0.88fr);
  column-gap: 24px;
  row-gap: 10px;
  align-items: start;
}

.dashboard-theme .sales-traceability-stage {
  min-width: 0;
}

.dashboard-theme .sales-traceability-document {
  max-width: 100%;
  padding: 8px 9px;
}

.dashboard-theme .sales-traceability-document header strong {
  font-size: .74rem;
}

.dashboard-theme .sales-traceability-document header span {
  padding: 2px 6px;
  font-size: .61rem;
}

.dashboard-theme .sales-traceability-document-tags {
  margin-top: 3px;
}

.dashboard-theme .sales-traceability-card-toggle {
  width: 20px;
  height: 20px;
  font-size: .8rem;
}

.dashboard-theme .sales-traceability-document.is-collapsed {
  min-height: 54px;
}

.dashboard-theme .sales-traceability-association-overlay {
  z-index: 2;
}

.dashboard-theme .sales-traceability-association-line {
  opacity: 0;
  stroke-width: 2.1;
  transition: opacity .15s ease, stroke-width .15s ease;
}

.dashboard-theme .sales-traceability-association-line.is-flow {
  stroke-dasharray: 0;
}

.dashboard-theme .sales-traceability-association-line.is-association {
  stroke-dasharray: 0;
}

.dashboard-theme .sales-traceability-association-line.is-active {
  opacity: .96;
  stroke-width: 2.8;
}

.dashboard-theme .sales-traceability-document.is-related-active {
  box-shadow: 0 0 0 1px rgb(42 128 86 / 18%), 0 8px 18px rgb(39 68 53 / 8%);
}

.dashboard-theme .sales-traceability-document.is-related-muted {
  opacity: .7;
}

.dashboard-theme .sales-traceability-association-marker {
  cursor: default;
}

.dashboard-theme .sales-traceability-association-marker:hover {
  transform: none;
  box-shadow: none;
}

@media (max-width: 1250px) {
  .dashboard-theme .sales-traceability-flow {
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    column-gap: 20px;
  }
}

@media (max-width: 900px) {
  .dashboard-theme .sales-traceability-flow {
    grid-template-columns: repeat(4, minmax(220px, 76vw));
    column-gap: 14px;
  }
}


/* Traceability refinement v7 — narrower columns and cleaner elbow arrows. */
.dashboard-theme .sales-traceability-flow {
  grid-template-columns:
    minmax(142px, 0.72fr)
    minmax(142px, 0.72fr)
    minmax(154px, 0.78fr)
    minmax(154px, 0.78fr);
  column-gap: 30px;
  row-gap: 8px;
}

.dashboard-theme .sales-traceability-document {
  padding: 7px 8px;
  border-radius: 10px;
}

.dashboard-theme .sales-traceability-document header {
  gap: 6px;
}

.dashboard-theme .sales-traceability-document header strong {
  font-size: .72rem;
  line-height: 1.12;
}

.dashboard-theme .sales-traceability-document header span {
  padding: 2px 5px;
  font-size: .58rem;
}

.dashboard-theme .sales-traceability-association-overlay {
  z-index: 2;
  overflow: visible;
}

.dashboard-theme .sales-traceability-association-line {
  opacity: 0;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity .14s ease, stroke-width .14s ease, filter .14s ease;
}

.dashboard-theme .sales-traceability-association-line.is-flow {
  opacity: 0;
}

.dashboard-theme .sales-traceability-association-line.is-active {
  opacity: .94;
  stroke-width: 2.35;
  filter: drop-shadow(0 0 1px rgb(255 255 255 / 60%));
}

.dashboard-theme .sales-traceability-association-line.is-flow.is-active {
  opacity: .9;
}

.dashboard-theme .sales-traceability-association-line.is-association.is-active {
  opacity: .96;
}

.dashboard-theme .sales-traceability-document.is-related-active {
  box-shadow: 0 0 0 1px rgb(42 128 86 / 16%), 0 6px 16px rgb(39 68 53 / 7%);
}

.dashboard-theme .sales-traceability-document.is-related-muted {
  opacity: .68;
}

@media (max-width: 1280px) {
  .dashboard-theme .sales-traceability-flow {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    column-gap: 24px;
  }
}

/* Traceability search assistance v8 — cascading branch/letter selectors. */
.dashboard-theme .sales-traceability-search select:disabled {
  cursor: wait;
  opacity: .68;
  background-color: #f3f6f4;
}

.dashboard-theme .sales-traceability-search label[hidden] {
  display: none !important;
}


/* Traceability refinement v9 — click a card to pin its complete route. */
.dashboard-theme .sales-traceability-document {
  cursor: pointer;
  transition: opacity .14s ease, box-shadow .14s ease, border-color .14s ease, transform .14s ease;
}

.dashboard-theme .sales-traceability-document button,
.dashboard-theme .sales-traceability-document summary,
.dashboard-theme .sales-traceability-document details {
  cursor: initial;
}

.dashboard-theme .sales-traceability-document button,
.dashboard-theme .sales-traceability-document summary {
  cursor: pointer;
}

.dashboard-theme .sales-traceability-document.is-traceability-selected {
  border-color: #2f7657;
  box-shadow: 0 0 0 2px rgb(47 118 87 / 18%), 0 7px 18px rgb(39 68 53 / 9%);
}

.dashboard-theme .sales-traceability-document.is-traceability-selected::after {
  content: '';
  position: absolute;
  top: 7px;
  left: -6px;
  width: 5px;
  height: calc(100% - 14px);
  border-radius: 999px;
  background: #2f7657;
  opacity: .9;
}


/* Traceability refinement v10 — distribute overlapping arrows across gutter lanes. */
.dashboard-theme .sales-traceability-association-line {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.dashboard-theme .sales-traceability-association-line.is-flow.is-active {
  stroke-width: 2.2;
  opacity: .82;
}

.dashboard-theme .sales-traceability-association-line.is-association.is-active {
  stroke-width: 2.5;
  opacity: .97;
}


/* Traceability refinement v11 — document-level connectors only. */
.dashboard-theme .sales-traceability-association-line {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-theme .sales-traceability-association-line.is-flow.is-active {
  stroke-width: 2.15;
  opacity: .9;
}

.dashboard-theme .sales-traceability-association-line.is-association.is-active {
  stroke-width: 2.45;
  opacity: .97;
}


/* Traceability refinement v12 — keep the main canvas limited to the verified
   connected component of the document that was actually searched. */
.dashboard-theme .sales-traceability-omitted-note {
  grid-column: 1 / -1;
  margin: -2px 0 2px;
  padding: 5px 8px;
  border-radius: 8px;
  background: #f7f9f7;
  color: #718078;
  font-size: .62rem;
  line-height: 1.25;
}


/* Traceability refinement v13 — richer compact info on order cards. */
.dashboard-theme .sales-traceability-order-meta {
  display: grid;
  gap: 4px;
  margin: 4px 0 8px;
  padding: 7px 8px;
  border: 1px solid #e5ece7;
  border-radius: 8px;
  background: #f8fbf9;
}

.dashboard-theme .sales-traceability-order-meta > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.dashboard-theme .sales-traceability-order-meta > div span {
  flex: 0 0 auto;
  color: #6d7f74;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.dashboard-theme .sales-traceability-order-meta > div strong {
  min-width: 0;
  color: #31483c;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Traceability refinement v15 — compact order header + exact customer/branch. */
.dashboard-theme .sales-traceability-document-heading {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.dashboard-theme .sales-traceability-order-date {
  color: #718078;
  font-size: .61rem;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-order-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 12px;
  margin: 3px 0 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dashboard-theme .sales-traceability-order-meta > div {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.dashboard-theme .sales-traceability-order-meta > div span {
  color: #75857c;
  font-size: .57rem;
  font-weight: 800;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.dashboard-theme .sales-traceability-order-meta > div strong {
  min-width: 0;
  max-width: 180px;
  color: #31483c;
  font-size: .64rem;
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-stage[data-stage="order"] .sales-traceability-document {
  padding-top: 7px;
  padding-bottom: 7px;
}


/* ========================================================================== */
/* Delidips refinement v16 — profitability card + expanded table              */
/* ========================================================================== */

/* Profitability is a compact summary. Do not stretch this single widget to
   the full remaining sales-tab height on desktop. */
@media (min-width: 1121px) and (min-height: 760px) {
  .dashboard-theme #sales-panel-profitability .sales-panel-grid {
    height: auto !important;
    grid-auto-rows: auto !important;
    align-content: start !important;
    align-items: start !important;
  }

  .dashboard-theme #sales-panel-profitability .sales-profitability-widget:not(.is-widget-maximized) {
    width: 100%;
    height: 226px !important;
    min-height: 226px !important;
    max-height: 226px !important;
    align-self: start;
  }
}

/* Use the full width of the summary card: KPI at left and the five margin
   bars at right. This removes the large unused area visible in the old card. */
.dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-widget-preview {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: 4px 4px 2px 0;
}

.dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-margin-value {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 104px;
  margin: 0;
  padding: 10px 22px 10px 4px;
  border-right: 1px solid #ddd5ca;
  border-bottom: 0;
}

.dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-margin-value span {
  font-size: .62rem;
  line-height: 1.15;
}

.dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-margin-value strong {
  font-size: 1.32rem;
  line-height: 1;
  font-weight: 800;
}

.dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-margin-mini-list {
  display: grid;
  gap: 8px;
  width: 100%;
  margin: 0;
}

.dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-margin-mini-list > div {
  grid-template-columns: 62px minmax(180px, 1fr) 54px;
  gap: 10px;
  min-height: 17px;
  font-size: .66rem;
}

.dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-margin-mini-list i {
  height: 10px;
}

.dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-margin-mini-list strong {
  min-width: 54px;
  font-size: .64rem;
}

/* Expanded profitability is one report, not two stacked headers. The detail
   heading already identifies the report, so remove the preview heading in the
   modal and dedicate the available space to the table. */
.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized {
  width: min(var(--widget-modal-width, 1180px), calc(100vw - 64px)) !important;
  max-width: 1180px !important;
  padding: 20px 22px !important;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized > .card-heading {
  display: none !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .sales-widget-detail {
  display: flex !important;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 0 !important;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .sales-expanded-heading {
  flex: 0 0 auto;
  align-items: flex-end;
  margin: 0 50px 12px 0;
  padding: 0;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .sales-expanded-heading h3 {
  font-size: 1.16rem;
  font-weight: 800;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .sales-expanded-heading p {
  max-width: 760px;
  font-size: .68rem;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .sales-expanded-table {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-height: min(620px, calc(100dvh - 180px));
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  border: 1px solid #e5ded4;
  border-radius: 14px;
  background: #fffdfa;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table col.col-code { width: 11%; }
.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table col.col-name { width: 29%; }
.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table col.col-money { width: 15%; }
.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table col.col-percent { width: 15%; }

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 42px;
  padding: 8px 10px;
  background: #f6f1e9;
  border-bottom: 1px solid #e4ddd2;
  vertical-align: middle;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table th button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  width: 100%;
  min-width: 0;
  padding: 0;
  font-size: .64rem;
  line-height: 1.15;
  white-space: normal;
  text-align: left;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table th.number-cell button {
  justify-content: flex-end;
  text-align: right;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table tbody td {
  height: 48px;
  padding: 8px 10px;
  border-bottom: 1px solid #eee8df;
  background: transparent;
  font-size: .72rem;
  line-height: 1.22;
  vertical-align: middle;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table td:nth-child(2) {
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table .number-cell {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-widget-preview {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dashboard-theme .sales-profitability-widget:not(.is-widget-maximized) .sales-margin-value {
    display: flex;
    min-height: 0;
    padding: 0 0 8px;
    border-right: 0;
    border-bottom: 1px solid #ddd5ca;
  }

  .dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    padding: 16px !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .sales-expanded-table {
    overflow-x: auto;
    overflow-y: auto;
  }

  .dashboard-theme .widget-modal-backdrop > .sales-profitability-widget.is-widget-maximized .profitability-table {
    min-width: 760px !important;
  }
}

/* Delidips refinement v17 — nested delivery detail modals must sit above a
   maximized widget. The widget overlay is z-index 1000 in the final cascade,
   so the detail modal needs its own higher stacking level. */
body.dashboard-theme.widget-maximized > .delivery-result-modal-backdrop:not([hidden]),
body.dashboard-theme.widget-maximized > .delivery-delay-modal-backdrop:not([hidden]) {
  z-index: 1400 !important;
}

body.dashboard-theme.widget-maximized > .delivery-result-modal-backdrop:not([hidden]) .modal-card,
body.dashboard-theme.widget-maximized > .delivery-delay-modal-backdrop:not([hidden]) .modal-card {
  position: relative;
  z-index: 1;
}


/* Delidips refinement v18 — robust nested modal stacking over maximized widgets.
   The detail modal is promoted to the body by JavaScript and receives an
   explicit stacking layer higher than the widget modal backdrop. */
body.dashboard-theme.widget-maximized .widget-modal-backdrop {
  z-index: 1000 !important;
}

body.dashboard-theme.widget-maximized > .modal-backdrop.nested-widget-modal-backdrop:not([hidden]) {
  z-index: 3000 !important;
  isolation: isolate;
  pointer-events: auto;
}

body.dashboard-theme.widget-maximized > .modal-backdrop.nested-widget-modal-backdrop:not([hidden]) > .modal-card {
  position: relative;
  z-index: 1;
}

body.dashboard-theme.widget-maximized.nested-widget-modal-open > .widget-modal-backdrop {
  pointer-events: none;
}


/* Delidips refinement v19 — production quality drill-down modals are generic
   data-modal overlays. Keep them above a maximized Alertas de calidad widget,
   even before/without the observer-based nested-modal synchronization. */
body.dashboard-theme.widget-maximized > .modal-backdrop[id^="batch-op-modal-"]:not([hidden]) {
  z-index: 3200 !important;
  isolation: isolate;
  pointer-events: auto;
}

body.dashboard-theme.widget-maximized > .modal-backdrop[id^="batch-op-modal-"]:not([hidden]) > .modal-card {
  position: relative;
  z-index: 1;
}


/* ========================================================================== */
/* Delidips refinement v40 — compact production active-order cards           */
/* ========================================================================== */

.dashboard-theme .production-active-panel .production-machine-groups {
  gap: 11px;
}

.dashboard-theme .production-active-panel .production-machine-group {
  min-width: 0;
}

.dashboard-theme .production-active-panel .production-machine-heading {
  min-height: 24px;
  margin-bottom: 6px;
  padding-bottom: 5px;
}

.dashboard-theme .production-active-panel .production-order-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 7px;
}

.dashboard-theme .production-active-panel .production-order-card {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 5px;
  min-height: 0;
  padding: 9px 10px;
  border-radius: 12px;
}

.dashboard-theme .production-active-panel .production-order-top {
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
}

.dashboard-theme .production-active-panel .production-order-top > .production-order-detail-button {
  flex: 0 1 auto;
  font-size: 11px;
  white-space: nowrap;
}

.dashboard-theme .production-active-panel .production-type-badge {
  flex: 0 1 auto;
  min-height: 21px;
  max-width: 66%;
  padding: 3px 6px;
  font-size: 10px;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .production-active-panel .production-order-card h4 {
  display: block;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  color: #283b38;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .production-active-panel .production-order-compact-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 9px;
  min-width: 0;
  padding-top: 5px;
  border-top: 1px dashed rgba(21, 42, 39, 0.11);
}

.dashboard-theme .production-active-panel .production-order-code {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #65716e;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .production-active-panel .production-order-quantity {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.dashboard-theme .production-active-panel .production-order-quantity span,
.dashboard-theme .production-active-panel .production-order-quantity strong {
  font-size: 10.5px;
  line-height: 1.15;
}

.dashboard-theme .production-active-panel .production-order-quantity span {
  color: #697572;
}

.dashboard-theme .production-active-panel .production-order-quantity strong {
  color: var(--production-ink);
  font-weight: 900;
}

.dashboard-theme .production-active-panel .production-carryover {
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}

.dashboard-theme .production-active-panel.is-widget-maximized .production-machine-groups {
  gap: 9px;
}

.dashboard-theme .production-active-panel.is-widget-maximized .production-order-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 7px;
}

.dashboard-theme .production-active-panel.is-widget-maximized .production-order-card {
  padding: 8px 9px;
}

@media (max-width: 1180px) {
  .dashboard-theme .production-active-panel .production-order-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .dashboard-theme .production-active-panel .production-order-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-theme .production-active-panel .production-order-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .production-active-panel .production-order-card h4 {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 480px) {
  .dashboard-theme .production-active-panel .production-order-grid {
    grid-template-columns: 1fr;
  }
}


/* Delidips refinement v42 — one consistent live-update banner for all monitors. */
.dashboard-theme .monitor-main-hero {
  min-height: 118px;
}

.dashboard-theme .monitor-main-hero .hero-copy {
  padding-right: 285px;
}

.dashboard-theme .monitor-main-status {
  position: absolute;
  z-index: 4;
  right: 18px;
  bottom: 17px;
  min-width: 220px;
  max-width: 250px;
  padding: 9px 12px;
  border-color: rgba(245, 159, 47, .26);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(245,159,47,.08)),
    rgba(5, 10, 12, .44);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 10px 26px rgba(0,0,0,.14);
  backdrop-filter: none;
}

.dashboard-theme .monitor-main-status .production-live-dot {
  background: #f59f2f;
  box-shadow: 0 0 0 5px rgba(245,159,47,.14);
}

.dashboard-theme .monitor-main-status strong {
  color: #fff;
  font-size: .70rem;
  font-weight: 850;
}

.dashboard-theme .monitor-main-status .production-monitor-status-copy > span {
  color: rgba(255,255,255,.68);
  font-size: .64rem;
  line-height: 1.35;
}

.dashboard-theme .monitor-main-status.is-error .production-live-dot {
  background: #e76b4d;
  box-shadow: 0 0 0 5px rgba(231,107,77,.14);
}

.dashboard-theme .monitor-toolbar {
  align-items: center;
}

@media (max-width: 900px) {
  .dashboard-theme .monitor-main-hero {
    min-height: 150px;
    padding-bottom: 58px;
  }

  .dashboard-theme .monitor-main-hero .hero-copy {
    padding-right: 90px;
  }

  .dashboard-theme .monitor-main-status {
    left: 18px;
    right: 18px;
    bottom: 12px;
    min-width: 0;
    max-width: none;
  }
}

/* Alert settings — branded destructive-action confirmation. */
body.configuration-alert-confirm-open {
  overflow: hidden;
}

.configuration-alert-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(14, 17, 15, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: configuration-alert-confirm-fade-in 140ms ease-out;
}

.configuration-alert-confirm-dialog {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 16px;
  width: min(440px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid rgba(44, 53, 48, 0.13);
  border-radius: 18px;
  background: #fbfaf6;
  box-shadow: 0 24px 70px rgba(13, 19, 16, 0.28);
  color: #27312c;
  animation: configuration-alert-confirm-pop-in 160ms ease-out;
}

.configuration-alert-confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(166, 56, 39, 0.2);
  border-radius: 12px;
  color: #9f3828;
  background: rgba(189, 61, 46, 0.08);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.configuration-alert-confirm-content {
  min-width: 0;
}

.configuration-alert-confirm-eyebrow {
  display: block;
  margin: 1px 0 5px;
  color: #a56a22;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.11em;
}

.configuration-alert-confirm-dialog h2 {
  margin: 0;
  color: #202924;
  font-size: 1.18rem;
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.configuration-alert-confirm-dialog p {
  margin: 7px 0 0;
  color: #68716c;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.45;
}

.configuration-alert-confirm-target {
  display: block;
  max-width: 100%;
  margin-top: 12px;
  padding: 9px 11px;
  overflow: hidden;
  border: 1px solid #e0e1dc;
  border-radius: 10px;
  color: #39423d;
  background: #f4f3ee;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.configuration-alert-confirm-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid #e4e4df;
}

.configuration-alert-confirm-actions button {
  min-width: 108px;
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--alert-control-radius, 10px);
  font-size: 0.77rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.configuration-alert-confirm-cancel {
  margin: 0;
}

.configuration-alert-confirm-delete {
  border: 1px solid #9d3325;
  color: #fff;
  background: #a93b2c;
  box-shadow: 0 5px 14px rgba(157, 51, 37, 0.18);
}

.configuration-alert-confirm-delete:hover {
  background: #963225;
}

.configuration-alert-confirm-actions button:focus-visible {
  outline: 3px solid rgba(176, 119, 38, 0.24);
  outline-offset: 2px;
}

@keyframes configuration-alert-confirm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes configuration-alert-confirm-pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 520px) {
  .configuration-alert-confirm-backdrop {
    padding: 16px;
  }

  .configuration-alert-confirm-dialog {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 13px;
    padding: 18px;
    border-radius: 16px;
  }

  .configuration-alert-confirm-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .configuration-alert-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .configuration-alert-confirm-actions button {
    min-width: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .configuration-alert-confirm-backdrop,
  .configuration-alert-confirm-dialog {
    animation: none;
  }
}

/* Production monitor — keep the maximized "Estado actual" header controls
   in their own lane so the live status never sits underneath the restore button. */
.dashboard-theme .widget-modal-backdrop > .production-active-panel.is-widget-maximized > .production-panel-heading {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 18px;
  min-height: 68px;
  margin-bottom: 12px;
  padding: 0 58px 12px 0;
}

.dashboard-theme .widget-modal-backdrop > .production-active-panel.is-widget-maximized > .production-panel-heading > div:first-child {
  min-width: 0;
}

.dashboard-theme .widget-modal-backdrop > .production-active-panel.is-widget-maximized > .production-panel-heading > .production-panel-count {
  position: static;
  align-self: start;
  justify-self: end;
  max-width: 190px;
  margin: 1px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .widget-modal-backdrop > .production-active-panel.is-widget-maximized > .production-panel-heading > .widget-control-group {
  position: absolute;
  top: 0;
  right: 0;
  gap: 8px;
  margin: 0;
}

.dashboard-theme .widget-modal-backdrop > .production-active-panel.is-widget-maximized .widget-maximize-button {
  --widget-close-visual-size: 34px;
  --widget-close-hit-size: 42px;
}

@media (max-width: 720px) {
  .dashboard-theme .widget-modal-backdrop > .production-active-panel.is-widget-maximized > .production-panel-heading {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 9px;
    min-height: 0;
    padding-right: 52px;
  }

  .dashboard-theme .widget-modal-backdrop > .production-active-panel.is-widget-maximized > .production-panel-heading > .production-panel-count {
    justify-self: start;
    max-width: min(100%, 190px);
    margin-top: 0;
  }
}

/* Production traceability V2.2 — selectable search mode */
.dashboard-theme .production-batch-traceability-search {
  grid-template-columns: minmax(190px, .72fr) minmax(270px, 1.35fr) minmax(170px, .75fr) auto;
}

.dashboard-theme .production-traceability-search-mode {
  min-width: 0;
}

.dashboard-theme .production-traceability-search-mode select {
  cursor: pointer;
}

.dashboard-theme .production-traceability-order-field {
  grid-column: 2 / span 2;
}

.dashboard-theme .production-batch-traceability-submit:disabled {
  cursor: not-allowed;
  opacity: .48;
}

@media (max-width: 980px) {
  .dashboard-theme .production-batch-traceability-search {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .production-traceability-order-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .dashboard-theme .production-batch-traceability-search {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .production-traceability-order-field {
    grid-column: auto;
  }
}

/* ========================================================================== */
/* Sales orders — daily order evolution                                         */
/* ========================================================================== */

.dashboard-theme .sales-orders-grid {
  grid-template-columns: minmax(0, 1.8fr) minmax(310px, .82fr);
  align-items: stretch;
  height: 100%;
}

.dashboard-theme .sales-orders-history-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 14px 16px 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: none;
}

.dashboard-theme .sales-orders-history-card > .card-heading {
  flex: 0 0 auto;
  min-height: 54px;
  margin: 0 0 4px;
  padding-right: 92px;
}

.dashboard-theme .sales-orders-history-card .sales-overview-heading h2 {
  margin-top: 3px;
  font-size: 1.12rem;
}

.dashboard-theme .sales-orders-history-card .sales-overview-heading p {
  max-width: 760px;
  margin-top: 3px;
  font-size: .60rem;
  line-height: 1.35;
}

.dashboard-theme .sales-orders-history-card .widget-control-group {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
}

.dashboard-theme .sales-orders-card-stats {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 27px;
  margin: 0 0 5px;
}

.dashboard-theme .sales-orders-total-chip,
.dashboard-theme .sales-orders-variation-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 24px;
  padding: 5px 9px;
  border: 1px solid #ddd5c9;
  border-radius: 999px;
  color: #59625f;
  background: #fffdf8;
  font-size: .59rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-theme .sales-orders-total-chip strong {
  color: #11181c;
  font-size: .72rem;
  font-weight: 950;
}

.dashboard-theme .sales-orders-variation-chip.is-positive {
  color: #236447;
  border-color: rgba(35, 100, 71, .24);
  background: rgba(35, 100, 71, .07);
}

.dashboard-theme .sales-orders-variation-chip.is-negative {
  color: #9a3e34;
  border-color: rgba(154, 62, 52, .22);
  background: rgba(154, 62, 52, .07);
}

.dashboard-theme .sales-orders-variation-chip.is-neutral {
  color: #59625f;
}

.dashboard-theme .sales-orders-chart-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 145px;
  width: 100%;
  overflow: hidden;
}

.dashboard-theme .sales-orders-chart-wrap > canvas,
.dashboard-theme .sales-orders-history-card #dailyOrdersChart {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
}

.dashboard-theme .sales-orders-empty {
  display: grid;
  flex: 1 1 auto;
  place-items: center;
  min-height: 150px;
}

.dashboard-theme .widget-modal-backdrop > .sales-orders-history-card.is-widget-maximized {
  display: flex;
  flex-direction: column;
  height: min(760px, calc(100dvh - 54px));
  max-height: calc(100dvh - 54px);
}

.dashboard-theme .widget-modal-backdrop > .sales-orders-history-card.is-widget-maximized .sales-orders-chart-wrap {
  flex: 1 1 auto;
  min-height: 420px;
}

@media (max-width: 900px), (max-height: 759px) {
  .dashboard-theme .sales-orders-history-card {
    height: auto;
    min-height: 360px;
  }

  .dashboard-theme .sales-orders-chart-wrap {
    min-height: 230px;
  }
}

@media (max-width: 560px) {
  .dashboard-theme .sales-orders-card-stats {
    flex-wrap: wrap;
  }

  .dashboard-theme .sales-orders-history-card > .card-heading {
    padding-right: 74px;
  }
}


.dashboard-theme .sales-order-status-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 14px 16px 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: none;
}

.dashboard-theme .sales-order-status-card > .card-heading {
  flex: 0 0 auto;
  min-height: 54px;
  margin: 0 0 7px;
  padding-right: 74px;
}

.dashboard-theme .sales-order-status-card .sales-overview-heading h2 {
  margin-top: 3px;
  font-size: 1.12rem;
}

.dashboard-theme .sales-order-status-card .sales-overview-heading p {
  margin-top: 3px;
  font-size: .60rem;
  line-height: 1.35;
}

.dashboard-theme .sales-order-status-card .widget-control-group {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
}

.dashboard-theme .sales-order-status-content {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(118px, .82fr) minmax(150px, 1.18fr);
  align-items: center;
  gap: 14px;
  min-height: 0;
}

.dashboard-theme .sales-order-status-chart-wrap {
  position: relative;
  width: 100%;
  height: 170px;
  min-height: 150px;
}

.dashboard-theme .sales-order-status-chart-wrap > canvas,
.dashboard-theme .sales-order-status-card #salesOrderStatusChart {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.dashboard-theme .sales-order-status-legend {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.dashboard-theme .sales-order-status-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 0;
  border-bottom: 1px solid rgba(17, 24, 28, .08);
  color: #56605e;
  font-size: .64rem;
  font-weight: 800;
  line-height: 1.2;
}

.dashboard-theme .sales-order-status-row:last-child {
  border-bottom: 0;
}

.dashboard-theme .sales-order-status-row strong {
  color: #11181c;
  font-size: .76rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .sales-order-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #11181c;
}

.dashboard-theme .sales-order-status-dot.is-prepare {
  background: #f59f2f;
}

.dashboard-theme .sales-order-status-dot.is-remit {
  background: #2f6fbd;
}

.dashboard-theme .sales-order-status-dot.is-invoice {
  background: #11181c;
}

.dashboard-theme .sales-order-status-note {
  flex: 0 0 auto;
  margin-top: 5px;
  color: #7a817e;
  font-size: .53rem;
  line-height: 1.25;
}

.dashboard-theme .sales-order-status-tooltip {
  position: absolute;
  z-index: 8;
  display: grid;
  gap: 5px;
  width: max-content;
  max-width: min(250px, calc(100% - 20px));
  padding: 12px 14px;
  pointer-events: none;
  border: 1px solid rgba(255, 250, 241, .14);
  border-radius: 12px;
  background: #101217;
  color: #fffaf1;
  box-shadow: 0 12px 28px rgba(16, 18, 23, .22);
  font-size: .70rem;
  line-height: 1.35;
}

.dashboard-theme .sales-order-status-tooltip[hidden] {
  display: none;
}

.dashboard-theme .sales-order-status-tooltip-title {
  display: block;
  font-size: .74rem;
  font-weight: 950;
}

.dashboard-theme .sales-order-status-tooltip-metric {
  display: block;
  font-weight: 850;
}

.dashboard-theme .sales-order-status-tooltip-note {
  display: block;
  max-width: 215px;
  color: rgba(255, 250, 241, .76);
  font-size: .63rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: normal;
}

.dashboard-theme .sales-order-status-empty {
  display: grid;
  flex: 1 1 auto;
  place-items: center;
  min-height: 165px;
  text-align: center;
}

.dashboard-theme .widget-modal-backdrop > .sales-order-status-card.is-widget-maximized {
  display: flex;
  flex-direction: column;
  height: min(650px, calc(100dvh - 54px));
  max-height: calc(100dvh - 54px);
}

.dashboard-theme .widget-modal-backdrop > .sales-order-status-card.is-widget-maximized .sales-order-status-content {
  grid-template-columns: minmax(280px, .9fr) minmax(280px, 1.1fr);
  gap: 34px;
}

.dashboard-theme .widget-modal-backdrop > .sales-order-status-card.is-widget-maximized .sales-order-status-chart-wrap {
  height: 380px;
}

@media (max-width: 900px) {
  .dashboard-theme .sales-orders-grid {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .dashboard-theme .sales-order-status-card {
    min-height: 290px;
  }

  .dashboard-theme .sales-order-status-content {
    grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .dashboard-theme .sales-order-status-card {
    min-height: 360px;
  }

  .dashboard-theme .sales-order-status-content {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .dashboard-theme .sales-order-status-chart-wrap {
    height: 170px;
  }
}

/* ========================================================================== */
/* Sales orders — validity proximity                                          */
/* ========================================================================== */

.dashboard-theme .sales-order-validity-card {
  position: relative;
  display: flex;
  grid-column: 1 / -1;
  flex-direction: column;
  width: 100%;
  min-height: 185px;
  margin: 0;
  padding: 14px 16px 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: none;
}

.dashboard-theme .sales-order-validity-card > .card-heading {
  flex: 0 0 auto;
  min-height: 54px;
  margin: 0 0 12px;
  padding-right: 92px;
}

.dashboard-theme .sales-order-validity-card .sales-overview-heading h2 {
  margin-top: 3px;
  font-size: 1.12rem;
}

.dashboard-theme .sales-order-validity-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.dashboard-theme .sales-order-validity-title-row h2 {
  margin-top: 0;
}

.dashboard-theme .sales-order-validity-date-select {
  width: auto;
  min-width: 96px;
  min-height: 28px;
  padding: 3px 26px 3px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.dashboard-theme .sales-order-validity-date-select:focus {
  outline: 3px solid rgb(42 128 86 / 16%);
  border-color: #2a8056;
}

.dashboard-theme .sales-order-validity-date-select:disabled {
  opacity: .6;
  cursor: wait;
}

.dashboard-theme .sales-order-validity-card .sales-overview-heading p {
  margin-top: 3px;
  font-size: .60rem;
  line-height: 1.35;
}

.dashboard-theme .sales-order-validity-card .widget-control-group {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
}

.dashboard-theme .sales-order-validity-buckets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.dashboard-theme .sales-order-validity-bucket {
  --validity-tone: #59625f;
  --validity-bg: rgba(89, 98, 95, .07);
  --validity-border: rgba(89, 98, 95, .16);
  display: grid;
  min-width: 0;
  min-height: 126px;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 12px 10px 10px;
  border: 1px solid var(--validity-border);
  border-radius: 14px;
  color: var(--validity-tone);
  background: var(--validity-bg);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.dashboard-theme .sales-order-validity-bucket.is-expired {
  --validity-tone: #8f342d;
  --validity-bg: rgba(174, 63, 52, .075);
  --validity-border: rgba(174, 63, 52, .18);
}

.dashboard-theme .sales-order-validity-bucket.is-critical {
  --validity-tone: #c83c31;
  --validity-bg: rgba(220, 70, 57, .08);
  --validity-border: rgba(220, 70, 57, .18);
}

.dashboard-theme .sales-order-validity-bucket.is-warning {
  --validity-tone: #c35f16;
  --validity-bg: rgba(235, 116, 28, .09);
  --validity-border: rgba(235, 116, 28, .19);
}

.dashboard-theme .sales-order-validity-bucket.is-watch {
  --validity-tone: #a66a00;
  --validity-bg: rgba(229, 165, 27, .10);
  --validity-border: rgba(229, 165, 27, .21);
}

.dashboard-theme .sales-order-validity-bucket.is-safe {
  --validity-tone: #27833d;
  --validity-bg: rgba(54, 161, 75, .09);
  --validity-border: rgba(54, 161, 75, .19);
}

.dashboard-theme .sales-order-validity-bucket:hover,
.dashboard-theme .sales-order-validity-bucket:focus-visible {
  transform: translateY(-1px);
  border-color: var(--validity-tone);
  box-shadow: 0 8px 20px rgba(16, 18, 23, .08);
  outline: none;
}

.dashboard-theme .sales-order-validity-bucket:focus-visible {
  box-shadow: 0 0 0 3px rgba(245, 159, 47, .24), 0 8px 20px rgba(16, 18, 23, .08);
}

.dashboard-theme .sales-order-validity-range {
  font-size: .67rem;
  font-weight: 950;
  letter-spacing: .01em;
}

.dashboard-theme .sales-order-validity-bucket strong {
  color: var(--validity-tone);
  font-size: 1.8rem;
  font-weight: 950;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .sales-order-validity-unit {
  font-size: .64rem;
  font-weight: 850;
}

.dashboard-theme .sales-order-validity-action {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 5px;
  padding: 4px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: .57rem;
  font-weight: 950;
  line-height: 1;
}

.dashboard-theme .sales-order-validity-empty {
  display: grid;
  flex: 1 1 auto;
  min-height: 120px;
  place-items: center;
  text-align: center;
}

.dashboard-theme .sales-order-validity-days {
  font-weight: 850;
}

.dashboard-theme .sales-order-validity-days.is-expired {
  color: #9a3e34;
}

.dashboard-theme .sales-order-validity-date {
  font-weight: 850;
}

.dashboard-theme .sales-order-validity-modal-card {
  display: flex;
  flex-direction: column;
  width: min(1320px, calc(100vw - 36px));
  max-height: min(780px, calc(100vh - 36px));
  overflow: hidden;
  padding: 18px;
}

@media (min-width: 901px) and (min-height: 760px) {
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-orders-grid {
    grid-template-rows: minmax(250px, 1.45fr) minmax(180px, .75fr);
    grid-auto-rows: auto;
  }
}

@media (max-width: 980px) {
  .dashboard-theme .sales-order-validity-buckets {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .dashboard-theme .sales-order-validity-card > .card-heading {
    padding-right: 74px;
  }

  .dashboard-theme .sales-order-validity-buckets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .sales-order-validity-bucket:last-child {
    grid-column: 1 / -1;
  }
}

/* ========================================================================== */
/* Sales orders — daily drill-down modal                                      */
/* ========================================================================== */

.dashboard-theme .sales-order-day-modal-card {
  display: flex;
  flex-direction: column;
  width: min(1240px, calc(100vw - 36px));
  max-height: min(780px, calc(100vh - 36px));
  overflow: hidden;
  padding: 18px;
}

.dashboard-theme .sales-order-day-modal-heading {
  flex: 0 0 auto;
  margin-bottom: 10px;
}

.dashboard-theme .sales-order-day-modal-heading .eyebrow {
  display: block;
  margin-bottom: 4px;
}

.dashboard-theme .sales-order-day-modal-heading h2 {
  font-size: 1.25rem;
}

.dashboard-theme .sales-order-day-modal-heading p {
  max-width: 760px;
  margin-top: 4px;
  font-size: .78rem;
}

.dashboard-theme .sales-order-day-modal-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
}

.dashboard-theme .sales-order-day-modal-meta span {
  color: #11181c;
  font-size: .72rem;
  font-weight: 950;
}

.dashboard-theme .sales-order-day-modal-meta small {
  color: #707684;
  font-size: .64rem;
  font-weight: 800;
  text-align: right;
}

.dashboard-theme .sales-order-day-state {
  display: grid;
  flex: 1 1 auto;
  min-height: 170px;
  place-items: center;
  padding: 24px;
  border: 1px dashed #d8d1c5;
  border-radius: 14px;
  color: #707684;
  background: #fffdf8;
  font-size: .78rem;
  font-weight: 850;
  text-align: center;
}

.dashboard-theme .sales-order-day-state[data-state="error"] {
  color: #9a3e34;
  border-color: rgba(154, 62, 52, .28);
  background: rgba(154, 62, 52, .05);
}

.dashboard-theme .sales-order-day-state[data-state="loading"]::before {
  width: 22px;
  height: 22px;
  margin-bottom: 8px;
  border: 3px solid rgba(17, 24, 28, .12);
  border-top-color: #f59f2f;
  border-radius: 50%;
  content: "";
  animation: loading-spin .8s linear infinite;
}

.dashboard-theme .sales-order-day-state[hidden] {
  display: none;
}

.dashboard-theme .sales-order-day-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
}

.dashboard-theme .sales-order-day-table-wrap[hidden] {
  display: none;
}

.dashboard-theme .sales-order-day-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: #11181c;
  font-size: .70rem;
}

.dashboard-theme .sales-order-day-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 0;
  border-bottom: 1px solid #d8d1c5;
  background: #f7f2e8;
  text-align: left;
  white-space: nowrap;
}

.dashboard-theme .sales-order-day-table th button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 0;
  color: #59625f;
  background: transparent;
  font: inherit;
  font-size: .62rem;
  font-weight: 950;
  letter-spacing: .035em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.dashboard-theme .sales-order-day-table th button:hover,
.dashboard-theme .sales-order-day-table th button:focus-visible {
  color: #11181c;
  background: rgba(245, 159, 47, .09);
  outline: none;
}

.dashboard-theme .sales-order-day-table th button:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(245, 159, 47, .55);
}

.dashboard-theme .sales-order-day-table th button span {
  color: #b8730e;
  font-size: .76rem;
  line-height: 1;
}

.dashboard-theme .sales-order-day-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(16, 18, 23, .06);
  vertical-align: middle;
  white-space: nowrap;
}

.dashboard-theme .sales-order-day-table tbody tr:nth-child(even) td {
  background: rgba(247, 242, 232, .36);
}

.dashboard-theme .sales-order-day-table tbody tr:hover td {
  background: rgba(245, 159, 47, .07);
}

.dashboard-theme .sales-order-day-number,
.dashboard-theme .sales-order-day-customer {
  font-weight: 900;
}

.dashboard-theme .sales-order-day-number {
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .sales-order-day-number-button {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 5px;
  border: 0;
  border-radius: 7px;
  color: #11181c;
  background: transparent;
  font: inherit;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.dashboard-theme .sales-order-day-number-button:hover,
.dashboard-theme .sales-order-day-number-button:focus-visible,
.dashboard-theme .sales-order-day-number-button[aria-expanded="true"] {
  color: #9b5b00;
  background: rgba(245, 159, 47, .13);
  outline: none;
}

.dashboard-theme .sales-order-day-number-button:focus-visible {
  box-shadow: 0 0 0 2px rgba(245, 159, 47, .48);
}

.sales-order-day-action-menu {
  position: fixed;
  z-index: 3400;
  min-width: 176px;
  padding: 6px;
  border: 1px solid rgba(17, 24, 28, .14);
  border-radius: 12px;
  background: #fffaf1;
  box-shadow: 0 14px 38px rgba(16, 18, 23, .24);
}

.sales-order-day-action-menu[hidden] {
  display: none;
}

.sales-order-day-action-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  color: #11181c;
  background: transparent;
  font: inherit;
  font-size: .72rem;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.sales-order-day-action-item:hover,
.sales-order-day-action-item:focus-visible {
  color: #8b5200;
  background: rgba(245, 159, 47, .14);
  outline: none;
}

.customer-account-document-action-menu .sales-order-day-action-item:disabled,
.customer-account-document-action-menu .sales-order-day-action-item:disabled:hover,
.customer-account-document-action-menu .sales-order-day-action-item:disabled:focus-visible {
  color: #969a98;
  background: transparent;
  cursor: default;
  opacity: .62;
}

.customer-account-document-action-menu .customer-account-purchase-scan-action:not(:disabled) {
  color: #8b5200;
}

.sales-order-day-action-icon {
  color: #b8730e;
  font-size: .9rem;
  line-height: 1;
}

body.dashboard-theme.widget-maximized > .sales-order-day-modal-backdrop:not([hidden]),
body.dashboard-theme.widget-maximized > .sales-order-validity-modal-backdrop:not([hidden]) {
  z-index: 3200 !important;
  isolation: isolate;
  pointer-events: auto;
}

@media (max-width: 760px) {
  .dashboard-theme .sales-order-day-modal-card,
  .dashboard-theme .sales-order-validity-modal-card {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
    padding: 13px;
    border-radius: 18px;
  }

  .dashboard-theme .sales-order-day-modal-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .dashboard-theme .sales-order-day-modal-meta small {
    text-align: left;
  }

  .dashboard-theme .sales-order-day-table {
    min-width: 920px;
  }

  .dashboard-theme .sales-order-validity-table {
    min-width: 1080px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-theme .sales-order-day-state[data-state="loading"]::before {
    animation: none;
  }
}

/* ========================================================================== */
/* Sales orders — desktop three-card composition                              */
/* ========================================================================== */

/* On wide screens keep the daily evolution, validity proximity and order
   status in a single row. The validity card becomes a compact middle summary
   so the three operational views remain visible without vertical clipping. */
@media (min-width: 1181px) {
  .dashboard-theme .sales-orders-grid {
    grid-template-columns: minmax(0, 1.62fr) minmax(245px, .64fr) minmax(305px, .82fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    height: 100%;
  }

  .dashboard-theme .sales-orders-grid > .sales-orders-history-card {
    grid-column: 1;
    grid-row: 1;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 14px 12px 15px;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-status-card {
    grid-column: 3;
    grid-row: 1;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card > .card-heading {
    min-height: 54px;
    margin-bottom: 8px;
    padding-right: 58px;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-title-row {
    align-items: flex-start;
    gap: 4px;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-overview-heading h2 {
    flex: 0 0 100%;
    max-width: none;
    font-size: .96rem;
    line-height: 1.08;
    white-space: nowrap;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-date-select {
    flex: 0 0 auto;
    min-width: 96px;
    margin-top: 0;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-overview-heading p {
    display: -webkit-box;
    max-width: 215px;
    margin-top: 4px;
    overflow: hidden;
    font-size: .55rem;
    line-height: 1.28;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .widget-control-group {
    top: 11px;
    right: 10px;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-buckets {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr);
    align-content: stretch;
    gap: 6px;
    min-height: 0;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-bucket {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "range value"
      "action unit";
    min-height: 0;
    place-items: initial;
    align-content: center;
    align-items: center;
    gap: 1px 8px;
    padding: 7px 9px;
    border-radius: 11px;
    text-align: left;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-range {
    grid-area: range;
    align-self: end;
    font-size: .61rem;
    line-height: 1.1;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-bucket strong {
    grid-area: value;
    align-self: center;
    justify-self: end;
    font-size: 1.28rem;
    line-height: .95;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-unit {
    grid-area: unit;
    align-self: start;
    justify-self: end;
    font-size: .50rem;
    line-height: 1;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-action {
    grid-area: action;
    align-self: start;
    justify-self: start;
    min-height: 0;
    margin-top: 1px;
    padding: 0;
    border: 0;
    border-radius: 0;
    font-size: .50rem;
    line-height: 1.05;
    opacity: .78;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-action::after {
    content: "  →";
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-empty {
    min-height: 0;
    padding: 14px 8px;
    font-size: .62rem;
    line-height: 1.35;
  }
}

/* Compact the middle validity list enough to share the same dashboard row. */
@media (min-width: 1181px) {
  .dashboard-theme .sales-orders-grid > .sales-order-validity-card > .card-heading {
    min-height: 46px;
    margin-bottom: 6px;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-overview-heading h2 {
    font-size: .91rem;
    line-height: 1.04;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-overview-heading p {
    -webkit-line-clamp: 1;
    font-size: .51rem;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-buckets {
    gap: 4px;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-bucket {
    grid-template-columns: minmax(0, 1fr) auto auto 14px;
    grid-template-areas: "range value unit action";
    gap: 5px;
    padding: 4px 7px;
    border-radius: 9px;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-range {
    align-self: center;
    font-size: .58rem;
    white-space: nowrap;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-bucket strong {
    align-self: center;
    font-size: 1.02rem;
    line-height: 1;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-unit {
    align-self: center;
    font-size: .47rem;
    white-space: nowrap;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-action {
    align-self: center;
    justify-self: end;
    width: 14px;
    overflow: hidden;
    color: currentColor;
    font-size: 0;
    line-height: 1;
    opacity: .9;
  }

  .dashboard-theme .sales-orders-grid > .sales-order-validity-card .sales-order-validity-action::after {
    content: "→";
    font-size: .82rem;
    font-weight: 950;
  }
}

/* ========================================================================== */
/* Sales orders — use the available vertical workspace on desktop             */
/* ========================================================================== */

/* The three-card desktop composition must not collapse to the compact preview
   height. On taller workstations, let the Pedidos workspace consume the free
   vertical area below the KPIs while keeping the page itself fixed. */
@media (min-width: 1181px) and (min-height: 820px) {
  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-tabbed-shell:has(#sales-panel-orders.is-active) {
    min-height: clamp(350px, 44dvh, 470px);
  }

  .dashboard-theme #sales-panel-orders.is-active,
  .dashboard-theme #sales-panel-orders.is-active .sales-orders-grid {
    min-height: clamp(350px, 44dvh, 470px);
    height: 100%;
  }

  .dashboard-theme #sales-panel-orders.is-active .sales-orders-grid {
    grid-template-rows: minmax(0, 1fr);
    align-content: stretch;
    align-items: stretch;
  }

  .dashboard-theme #sales-panel-orders.is-active .sales-orders-history-card,
  .dashboard-theme #sales-panel-orders.is-active .sales-order-validity-card,
  .dashboard-theme #sales-panel-orders.is-active .sales-order-status-card {
    height: 100%;
    min-height: 0;
  }

  /* With the additional height, give the validity rows a little more breathing
     room instead of leaving unused space inside the middle card. */
  .dashboard-theme #sales-panel-orders.is-active .sales-order-validity-card > .card-heading {
    min-height: 52px;
    margin-bottom: 8px;
  }

  .dashboard-theme #sales-panel-orders.is-active .sales-order-validity-card .sales-order-validity-buckets {
    gap: 6px;
  }

  .dashboard-theme #sales-panel-orders.is-active .sales-order-validity-card .sales-order-validity-bucket {
    padding: 8px 9px;
  }

  .dashboard-theme #sales-panel-orders.is-active .sales-order-validity-card .sales-order-validity-bucket strong {
    font-size: 1.15rem;
  }

  /* The status card also uses the extra height so the chart is not visually
     stranded at the top of a taller card. */
  .dashboard-theme #sales-panel-orders.is-active .sales-order-status-content {
    align-content: center;
  }

  .dashboard-theme #sales-panel-orders.is-active .sales-order-status-chart-wrap {
    height: 205px;
    min-height: 185px;
  }
}


/* Sales tabs: keep the active pill readable while hovering it. */
.dashboard-theme .sales-section-tabs .sales-section-tab.is-active:hover,
.dashboard-theme .sales-section-tabs a.is-active:hover {
  color: #fff;
  background: linear-gradient(135deg, #10171b 0%, #252d31 78%, #49371f 100%);
  box-shadow:
    inset 0 -2px 0 rgba(245,159,47,.76),
    inset 0 1px 0 rgba(255,255,255,.04);
}

/* Traceability refinement v17 — explicit validity + "no entregar" semantics. */
.dashboard-theme .sales-traceability-document-heading {
  flex-wrap: wrap;
  row-gap: 2px;
}

.dashboard-theme .sales-traceability-order-date,
.dashboard-theme .sales-traceability-order-validity {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 999px;
  padding: 2px 6px;
  background: #f2f5f3;
  color: #65776d;
  font-size: .58rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-order-validity {
  background: #fff5df;
  color: #805e18;
}

.dashboard-theme .sales-traceability-order-validity.is-missing {
  background: #f1f1ef;
  color: #77756f;
}

.dashboard-theme .sales-traceability-lines > div.is-no-delivery {
  border-top-color: #ead8b1;
  background: linear-gradient(90deg, rgb(255 248 232 / 72%), transparent 78%);
}

.dashboard-theme .sales-traceability-lines > div > span {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.dashboard-theme .sales-traceability-no-delivery-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 999px;
  background: #fff0cb;
  padding: 2px 6px;
  color: #875f0f;
  font-size: .56rem;
  font-weight: 900;
  letter-spacing: .025em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Traceability refinement v18 — highlight the exact order lines still pending remittance. */
.dashboard-theme .sales-traceability-lines > div.is-pending-remit {
  border-top-color: #efc4ac;
  background: linear-gradient(90deg, rgb(255 240 231 / 86%), transparent 82%);
}

.dashboard-theme .sales-traceability-pending-remit-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 999px;
  background: #fde7dc;
  padding: 2px 6px;
  color: #a84727;
  font-size: .56rem;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-document summary[title] {
  text-decoration: underline dotted rgb(40 115 78 / 38%);
  text-underline-offset: 3px;
}

/* Resalta el pedido abierto desde una alerta de vigencia de Ventas. */
.dashboard-theme .sales-order-validity-table tbody tr.is-alert-target td {
  background: rgba(245, 159, 47, .16);
  box-shadow: inset 0 2px 0 rgba(231, 154, 56, .48), inset 0 -2px 0 rgba(231, 154, 56, .48);
}

.dashboard-theme .sales-order-validity-table tbody tr.is-alert-target td:first-child {
  box-shadow: inset 4px 0 0 #e79a38, inset 0 2px 0 rgba(231, 154, 56, .48), inset 0 -2px 0 rgba(231, 154, 56, .48);
}

.dashboard-theme .sales-order-validity-table tbody tr.is-alert-target .sales-order-day-number-button {
  color: #9b5b00;
  background: rgba(245, 159, 47, .18);
  box-shadow: 0 0 0 2px rgba(245, 159, 47, .42);
}

/* ========================================================================== */
/* Delidips refinement v20 — artículos por debajo del stock mínimo            */
/* ========================================================================== */

.dashboard-theme .stock-minimum-widget {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  height: clamp(390px, 47vh, 455px);
}

.dashboard-theme .stock-minimum-widget > .stock-widget-preview {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.dashboard-theme .stock-minimum-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.dashboard-theme .stock-minimum-summary span,
.dashboard-theme .stock-minimum-status {
  --stock-state: #9a6d18;
  --stock-state-soft: rgba(154, 109, 24, .10);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--stock-state) 22%, transparent);
  border-radius: 999px;
  color: var(--stock-state);
  background: var(--stock-state-soft);
  font-size: .6rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-theme .stock-minimum-summary span.is-critical,
.dashboard-theme .stock-minimum-status.is-critical,
.dashboard-theme .stock-minimum-row.is-critical,
.dashboard-theme .stock-minimum-detail-row.is-critical {
  --stock-state: #b42318;
  --stock-state-soft: rgba(180, 35, 24, .09);
}

.dashboard-theme .stock-minimum-summary span.is-low,
.dashboard-theme .stock-minimum-status.is-low,
.dashboard-theme .stock-minimum-row.is-low,
.dashboard-theme .stock-minimum-detail-row.is-low {
  --stock-state: #b76e00;
  --stock-state-soft: rgba(183, 110, 0, .10);
}

.dashboard-theme .stock-minimum-summary span.is-attention,
.dashboard-theme .stock-minimum-status.is-attention,
.dashboard-theme .stock-minimum-row.is-attention,
.dashboard-theme .stock-minimum-detail-row.is-attention {
  --stock-state: #786314;
  --stock-state-soft: rgba(120, 99, 20, .09);
}

.dashboard-theme .stock-minimum-summary b {
  font-size: .65rem;
}

.dashboard-theme .stock-minimum-preview-list {
  display: grid;
  gap: 7px;
  height: calc(100% - 36px);
  min-height: 0;
  padding-right: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 92, 91, .5) transparent;
}

.dashboard-theme .stock-minimum-preview-list::-webkit-scrollbar,
.dashboard-theme .stock-minimum-detail-list::-webkit-scrollbar {
  width: 7px;
}

.dashboard-theme .stock-minimum-preview-list::-webkit-scrollbar-thumb,
.dashboard-theme .stock-minimum-detail-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(90, 92, 91, .48);
  background-clip: padding-box;
}

.dashboard-theme .stock-minimum-row {
  --stock-state: #786314;
  --stock-state-soft: rgba(120, 99, 20, .09);
  display: grid;
  grid-template-columns: minmax(220px, .92fr) minmax(360px, 1.55fr) minmax(110px, .42fr);
  gap: 16px;
  align-items: center;
  min-height: 62px;
  padding: 8px 11px;
  border: 1px solid #e2ddd4;
  border-left: 3px solid var(--stock-state);
  border-radius: 13px;
  background: rgba(255, 255, 255, .64);
}

.dashboard-theme .stock-minimum-row-heading,
.dashboard-theme .stock-minimum-detail-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.dashboard-theme .stock-minimum-row-heading {
  justify-content: space-between;
}

.dashboard-theme .stock-minimum-article,
.dashboard-theme .stock-minimum-detail-identity > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dashboard-theme .stock-minimum-article strong,
.dashboard-theme .stock-minimum-detail-identity strong {
  overflow: hidden;
  color: #182126;
  font-size: .68rem;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .stock-minimum-article small,
.dashboard-theme .stock-minimum-detail-identity small {
  overflow: hidden;
  color: #7a8184;
  font-size: .56rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .stock-minimum-status {
  flex: 0 0 auto;
  min-height: 21px;
  padding: 3px 7px;
  font-size: .56rem;
}

.dashboard-theme .stock-minimum-bars {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-theme .stock-minimum-bar {
  display: grid;
  grid-template-columns: 43px minmax(90px, 1fr) 62px;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.dashboard-theme .stock-minimum-bar > span {
  color: #777e81;
  font-size: .54rem;
  font-weight: 800;
}

.dashboard-theme .stock-minimum-bar > i {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e1da;
}

.dashboard-theme .stock-minimum-bar > i > b {
  display: block;
  width: var(--stock-level);
  height: 100%;
  border-radius: inherit;
  background: #242c30;
}

.dashboard-theme .stock-minimum-row .stock-minimum-bar.is-current > i > b,
.dashboard-theme .stock-minimum-detail-row .stock-minimum-bar.is-current > i > b {
  background: var(--stock-state);
}

.dashboard-theme .stock-minimum-bar > strong {
  color: #353e42;
  font-size: .61rem;
  font-weight: 850;
  text-align: right;
}

.dashboard-theme .stock-minimum-deficit {
  display: grid;
  justify-items: end;
  gap: 1px;
  min-width: 0;
  text-align: right;
}

.dashboard-theme .stock-minimum-deficit strong {
  color: var(--stock-state);
  font-size: .8rem;
  font-weight: 950;
}

.dashboard-theme .stock-minimum-deficit small {
  max-width: 130px;
  color: #7b8284;
  font-size: .54rem;
  font-weight: 700;
  line-height: 1.2;
}

.dashboard-theme .widget-modal-backdrop > .stock-minimum-widget.is-widget-maximized {
  width: min(1180px, calc(100vw - 42px)) !important;
  max-width: 1180px !important;
  height: min(760px, calc(100dvh - 50px)) !important;
  max-height: calc(100dvh - 50px);
}

.dashboard-theme .widget-modal-backdrop > .stock-minimum-widget.is-widget-maximized .stock-widget-detail {
  display: flex !important;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.dashboard-theme .stock-minimum-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4ded5;
}

.dashboard-theme .stock-minimum-status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dashboard-theme .stock-minimum-status-filters button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #d9d3c9;
  border-radius: 999px;
  color: #555e62;
  background: rgba(255, 255, 255, .78);
  font: inherit;
  font-size: .62rem;
  font-weight: 800;
  cursor: pointer;
}

.dashboard-theme .stock-minimum-status-filters button span {
  display: inline-grid;
  min-width: 19px;
  min-height: 19px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  color: #6a7073;
  background: #efebe4;
  font-size: .55rem;
}

.dashboard-theme .stock-minimum-status-filters button.is-active {
  border-color: #11181c;
  color: #fff;
  background: #11181c;
}

.dashboard-theme .stock-minimum-status-filters button.is-active span {
  color: #11181c;
  background: #f6a62f;
}

.dashboard-theme .stock-minimum-sort {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.dashboard-theme .stock-minimum-sort > span {
  color: #72797c;
  font-size: .58rem;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-theme .stock-minimum-sort select {
  min-height: 31px;
  padding: 4px 28px 4px 9px;
  border: 1px solid #d8d2c8;
  border-radius: 9px;
  color: #263035;
  background: #fff;
  font-size: .62rem;
  font-weight: 800;
}

.dashboard-theme .stock-minimum-result-count {
  margin: 0 0 6px;
  color: #7a8184;
  font-size: .57rem;
  font-weight: 750;
}

.dashboard-theme .stock-minimum-detail-list {
  display: grid;
  gap: 7px;
  min-height: 0;
  padding-right: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 92, 91, .5) transparent;
}

.dashboard-theme .stock-minimum-detail-row {
  --stock-state: #786314;
  --stock-state-soft: rgba(120, 99, 20, .09);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(390px, 1.45fr) minmax(125px, .42fr);
  gap: 18px;
  align-items: center;
  min-height: 68px;
  padding: 9px 11px;
  border: 1px solid #e2ddd4;
  border-left: 4px solid var(--stock-state);
  border-radius: 13px;
  background: rgba(255, 255, 255, .74);
}

.dashboard-theme .stock-minimum-detail-row[hidden] {
  display: none !important;
}

.dashboard-theme .stock-minimum-detail-row.is-alert-target {
  border-color: #e79a38;
  box-shadow: 0 0 0 3px rgba(231, 154, 56, .22), 0 10px 26px rgba(156, 91, 0, .12);
  animation: stock-minimum-alert-target-pulse 1.6s ease-out 1;
}

@keyframes stock-minimum-alert-target-pulse {
  0% { box-shadow: 0 0 0 0 rgba(231, 154, 56, .52); }
  100% { box-shadow: 0 0 0 3px rgba(231, 154, 56, .22), 0 10px 26px rgba(156, 91, 0, .12); }
}

.dashboard-theme .stock-minimum-detail-identity > .stock-minimum-status {
  min-width: 64px;
  justify-content: center;
}

@media (max-width: 980px) {
  .dashboard-theme .stock-minimum-widget {
    height: auto;
    min-height: 390px;
  }

  .dashboard-theme .stock-minimum-row,
  .dashboard-theme .stock-minimum-detail-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .dashboard-theme .stock-minimum-deficit {
    justify-items: start;
    text-align: left;
  }

  .dashboard-theme .stock-minimum-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .dashboard-theme .stock-minimum-bar {
    grid-template-columns: 40px minmax(70px, 1fr) 55px;
    gap: 6px;
  }

  .dashboard-theme .stock-minimum-sort {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-theme .stock-minimum-sort select {
    max-width: 190px;
  }
}

/* ========================================================================== */
/* Delidips refinement v21 — Stock: compact widgets in desktop grid            */
/* ========================================================================== */

/* Stock widgets share a compact two-column grid on desktop. Medium and small
   screens keep the responsive fallbacks below. */
.dashboard-theme .stock-compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.dashboard-theme .stock-minimum-widget {
  grid-column: auto;
  height: clamp(330px, 42vh, 420px);
}

/* The minimum-stock preview needs a denser composition when it occupies one
   third of the dashboard. Its maximized/detail presentation remains unchanged. */
.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-summary {
  gap: 5px;
  margin-bottom: 8px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-summary span {
  min-height: 22px;
  padding: 3px 7px;
  font-size: .56rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-preview-list {
  gap: 6px;
  height: calc(100% - 31px);
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-row {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "identity deficit"
    "bars bars";
  gap: 6px 10px;
  min-height: 78px;
  padding: 7px 9px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-row-heading {
  grid-area: identity;
  gap: 7px;
  justify-content: flex-start;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-article {
  flex: 1 1 auto;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-status {
  padding: 3px 6px;
  font-size: .52rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-bars {
  grid-area: bars;
  gap: 3px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-bar {
  grid-template-columns: 38px minmax(70px, 1fr) 56px;
  gap: 6px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-bar > span {
  font-size: .57rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-bar > i {
  height: 7px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-bar > strong {
  font-size: .57rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-deficit {
  grid-area: deficit;
  align-self: center;
  gap: 0;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-deficit strong {
  font-size: .72rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-deficit small {
  max-width: 105px;
  font-size: .58rem;
}

/* Two columns are more legible on narrower desktop/laptop widths. The third
   widget uses the full second row there; below 1120px the existing one-column
   layout continues to apply. */
@media (max-width: 1480px) and (min-width: 1121px) {
  .dashboard-theme .stock-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .stock-minimum-widget {
    grid-column: auto;
  }

  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-row {
    grid-template-columns: minmax(220px, .92fr) minmax(360px, 1.55fr) minmax(110px, .42fr);
    grid-template-areas: none;
    gap: 16px;
    min-height: 62px;
    padding: 8px 11px;
  }

  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-row-heading,
  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-bars,
  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-deficit {
    grid-area: auto;
  }

  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-row-heading {
    justify-content: space-between;
  }

  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-bar {
    grid-template-columns: 43px minmax(90px, 1fr) 62px;
    gap: 8px;
  }
}

@media (max-width: 1120px) {
  .dashboard-theme .stock-compact-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .stock-minimum-widget {
    grid-column: auto;
    height: auto;
    min-height: 390px;
  }
}

/* ========================================================================== */
/* Delidips refinement v22 — Stock mínimo: una sola escala y mayor densidad   */
/* ========================================================================== */

/* Una única escala representa el mínimo como el extremo derecho (100 %) y el
   stock actual como relleno + marcador. Esto evita comparar dos barras que
   expresaban la misma referencia y libera altura para mostrar más artículos. */
.dashboard-theme .stock-minimum-gauge {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-theme .stock-minimum-gauge-values {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.dashboard-theme .stock-minimum-gauge-values > span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  color: #747c80;
  white-space: nowrap;
}

.dashboard-theme .stock-minimum-gauge-values small {
  font-size: .5rem;
  font-weight: 800;
}

.dashboard-theme .stock-minimum-gauge-values strong {
  color: #2d373c;
  font-size: .58rem;
  font-weight: 900;
}

.dashboard-theme .stock-minimum-gauge-values > span:first-child strong {
  color: var(--stock-state);
}

.dashboard-theme .stock-minimum-gauge-track {
  position: relative;
  display: block;
  height: 8px;
  margin-right: 2px;
  border-radius: 999px;
  background: #e5e1da;
}

.dashboard-theme .stock-minimum-gauge-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--stock-current);
  border-radius: inherit;
  background: var(--stock-state);
}

.dashboard-theme .stock-minimum-gauge-current {
  position: absolute;
  top: 50%;
  left: var(--stock-current);
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--stock-state);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--stock-state) 45%, transparent);
  transform: translate(-50%, -50%);
}

.dashboard-theme .stock-minimum-gauge-minimum {
  position: absolute;
  top: -3px;
  right: 0;
  width: 2px;
  height: 14px;
  border-radius: 999px;
  background: #1c252a;
  transform: translateX(1px);
}

/* En la tarjeta de tres columnas se compactan cabecera, resumen y filas para
   que entren más artículos sin aumentar la altura ni romper la alineación. */
.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .card-heading {
  gap: 8px;
  margin-bottom: 7px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .card-heading h2 {
  margin-bottom: 2px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .chart-insight {
  max-width: 100%;
  font-size: .54rem;
  line-height: 1.25;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-summary {
  gap: 4px;
  margin-bottom: 6px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-summary span {
  min-height: 20px;
  padding: 2px 6px;
  font-size: .52rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-summary b {
  font-size: .58rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-preview-list {
  gap: 5px;
  height: calc(100% - 26px);
  padding-right: 4px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-row {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "identity deficit"
    "gauge gauge";
  gap: 4px 9px;
  min-height: 60px;
  padding: 6px 8px;
  border-radius: 11px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-row-heading {
  grid-area: identity;
  gap: 6px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-gauge {
  grid-area: gauge;
  gap: 3px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-gauge-track {
  height: 7px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-gauge-current {
  width: 7px;
  height: 7px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-gauge-minimum {
  top: -2px;
  height: 11px;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-gauge-values small {
  font-size: .47rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-gauge-values strong {
  font-size: .54rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-deficit {
  grid-area: deficit;
  align-self: start;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-deficit strong {
  font-size: .68rem;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-deficit small {
  max-width: 100px;
  font-size: .47rem;
}

/* La vista maximizada mantiene una fila amplia, pero también usa la nueva
   escala única para que la lectura sea consistente con el card compacto. */
.dashboard-theme .stock-minimum-detail-row {
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.45fr) minmax(125px, .42fr);
}

@media (max-width: 1480px) and (min-width: 1121px) {
  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-row {
    grid-template-columns: minmax(220px, .95fr) minmax(330px, 1.45fr) minmax(110px, .42fr);
    grid-template-areas: "identity gauge deficit";
    gap: 14px;
    min-height: 58px;
    padding: 7px 10px;
  }

  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-row-heading,
  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-gauge,
  .dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) .stock-minimum-deficit {
    grid-area: auto;
  }
}

@media (max-width: 980px) {
  .dashboard-theme .stock-minimum-detail-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ========================================================================== */
/* Delidips refinement v23 — Stock mínimo: chip en cabecera                   */
/* ========================================================================== */

/* Mantiene el contador de artículos en la misma línea superior que los
   controles del widget, igual que el chip "filas" del card vecino. Al salir
   del flujo normal se recupera altura útil para la lista/gráfico. */
.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) > .card-heading {
  position: relative;
}

.dashboard-theme .stock-minimum-widget:not(.is-widget-maximized) > .card-heading > .metric-chip {
  position: absolute;
  top: 0;
  right: 118px;
  z-index: 2;
  min-height: 27px;
  margin: 0;
  padding: 4px 8px;
  font-size: .60rem;
}

/* Stock usa sólo dos indicadores en la cabecera. Mantenerlos compactos evita
   que ocupen más altura que los KPI de cuentas corrientes. */
.dashboard-theme .kpi-grid:has(> [data-widget-id="stock-proximo-vencer"]) {
  margin-bottom: 14px;
}

.dashboard-theme .kpi-grid:has(> [data-widget-id="stock-proximo-vencer"]) .kpi-card {
  min-height: 86px;
  padding: 11px 14px;
  border-radius: 15px;
}

.dashboard-theme .kpi-grid:has(> [data-widget-id="stock-proximo-vencer"]) .kpi-card > span,
.dashboard-theme .kpi-grid:has(> [data-widget-id="stock-proximo-vencer"]) .kpi-card small {
  font-size: .68rem;
}

.dashboard-theme .kpi-grid:has(> [data-widget-id="stock-proximo-vencer"]) .kpi-card strong {
  margin: 7px 0 5px;
  font-size: clamp(1.15rem, 1.55vw, 1.55rem);
  letter-spacing: -0.055em;
}

/* Compras: los indicadores simples deben dejar el foco visual en la
   trazabilidad y en los widgets del resumen, no ocupar media pantalla. */
.dashboard-theme .kpi-grid:has(> [data-widget-id="compras-ocs-pendientes"]) .kpi-card {
  min-height: 60px;
  padding: 8px 12px;
  border-radius: 12px;
}

.dashboard-theme .kpi-grid:has(> [data-widget-id="compras-ocs-pendientes"]) .kpi-card span,
.dashboard-theme .kpi-grid:has(> [data-widget-id="compras-ocs-pendientes"]) .kpi-card small {
  font-size: .66rem;
}

.dashboard-theme .kpi-grid:has(> [data-widget-id="compras-ocs-pendientes"]) .kpi-card strong {
  margin: 5px 0 3px;
  font-size: clamp(1.05rem, 1.7vw, 1.65rem);
}

/* ========================================================================== */
/* Delidips refinement v24 — trazabilidad más informativa y sin scroll interno */
/* ========================================================================== */

.dashboard-theme .sales-traceability-search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.dashboard-theme .sales-traceability-search button .ui-icon,
.dashboard-theme .sales-order-day-action-item .ui-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

/* Fecha, contraparte y cantidad de artículos siguen visibles cuando un remito
   o comprobante está colapsado. Al expandirlo, el detalle completo los reemplaza. */
.dashboard-theme .sales-traceability-document-compact-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 5px 7px;
  min-width: 0;
  margin-top: 5px;
  color: #687970;
  font-size: .60rem;
  line-height: 1.15;
}

.dashboard-theme .sales-traceability-document-compact-meta > span {
  min-width: 0;
}

.dashboard-theme .sales-traceability-compact-date {
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-compact-party {
  overflow: hidden;
  color: #43584d;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-compact-count {
  border-radius: 999px;
  background: #f1f5f2;
  padding: 2px 5px;
  color: #52685c;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-theme .sales-traceability-document.is-expanded .sales-traceability-document-compact-meta {
  display: none;
}

/* Las uniones verificadas forman parte del resultado y quedan visibles desde
   el primer render; hover/click sólo las enfatiza. */
.dashboard-theme .sales-traceability-association-line.is-flow {
  opacity: .72;
  stroke-width: 2.05;
}

.dashboard-theme .sales-traceability-association-line.is-flow.is-active {
  opacity: .98;
  stroke-width: 2.55;
}

/* En escritorio el flujo crece con los documentos expandidos y usa el scroll
   normal de la página. Esto evita las barras horizontal/vertical internas que
   quedaban activas después de abrir un remito o factura. */
@media (min-width: 901px) {
  .dashboard-theme .sales-traceability-flow {
    overflow: visible;
  }
}

/* En pantallas angostas se conserva el desplazamiento horizontal necesario,
   pero no se crea una segunda barra vertical dentro del flujo. */
@media (max-width: 900px) {
  .dashboard-theme .sales-traceability-flow {
    overflow-x: auto;
    overflow-y: hidden;
  }
}

/* ========================================================================== */
/* Sistemas Monark — shared brand mark in every top dashboard banner.         */
/* Keeps the existing hero height and separates the operational copy with a   */
/* small branded divider instead of adding another row.                       */
/* ========================================================================== */
.dashboard-theme .hero-system-brand {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 118px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  transform: translateY(-50%);
  pointer-events: none;
}

.dashboard-theme .hero-system-brand-separator {
  position: relative;
  display: block;
  width: 2px;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(245, 159, 47, .38) 12%,
    rgba(245, 159, 47, .96) 50%,
    rgba(245, 159, 47, .38) 88%,
    transparent 100%
  );
  box-shadow: 0 0 16px rgba(245, 159, 47, .16);
}

.dashboard-theme .hero-system-brand-separator::before,
.dashboard-theme .hero-system-brand-separator::after {
  position: absolute;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  content: "";
  transform: translateX(-50%);
  background: #f59f2f;
  box-shadow: 0 0 0 3px rgba(245, 159, 47, .08);
}

.dashboard-theme .hero-system-brand-separator::before {
  top: -1px;
}

.dashboard-theme .hero-system-brand-separator::after {
  bottom: -1px;
}

.dashboard-theme .hero-system-brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(245, 159, 47, .28);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(255, 253, 248, .97), rgba(244, 238, 227, .93));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 8px 20px rgba(0, 0, 0, .16);
}

.dashboard-theme .hero-system-brand-mark img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

/* Monitor banners already reserve the right side for the live-status card. */
.dashboard-theme .monitor-main-hero .hero-system-brand {
  right: 286px;
}

@media (max-width: 1050px) {
  .dashboard-theme .hero-system-brand {
    right: 104px;
    gap: 8px;
  }

  .dashboard-theme .hero-system-brand-separator {
    height: 34px;
  }

  .dashboard-theme .hero-system-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 11px;
  }

  .dashboard-theme .hero-system-brand-mark img {
    width: 35px;
    height: 35px;
  }

  .dashboard-theme .monitor-main-hero .hero-system-brand {
    right: 272px;
  }
}

@media (max-width: 900px) {
  .dashboard-theme .hero-system-brand,
  .dashboard-theme .monitor-main-hero .hero-system-brand {
    top: 42px;
    right: 14px;
    gap: 7px;
    transform: none;
  }

  .dashboard-theme .hero-system-brand-separator {
    height: 30px;
  }

  .dashboard-theme .hero-system-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .dashboard-theme .hero-system-brand-mark img {
    width: 30px;
    height: 30px;
  }
}

@media (max-width: 560px) {
  .dashboard-theme .hero-system-brand-separator {
    display: none;
  }

  .dashboard-theme .hero-system-brand-mark {
    width: 32px;
    height: 32px;
  }

  .dashboard-theme .hero-system-brand-mark img {
    width: 27px;
    height: 27px;
  }
}

/* ========================================================================== */
/* Sistemas Monark — brand lockup on the LEFT of every top banner.            */
/* The supplied full logo is shown on a light plaque; the existing dashboard   */
/* copy remains immediately to its right, without increasing the hero height.  */
/* ========================================================================== */
.dashboard-theme .hero-system-brand,
.dashboard-theme .monitor-main-hero .hero-system-brand {
  top: 50%;
  left: 22px;
  right: auto;
  flex-direction: row-reverse;
  gap: 12px;
  transform: translateY(-50%);
}

.dashboard-theme .hero-system-brand-mark {
  width: 142px;
  height: 58px;
  padding: 6px 9px;
  border: 1px solid rgba(245, 159, 47, .34);
  border-radius: 13px;
  background: linear-gradient(145deg, #fffdf8 0%, #f4eee3 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    0 7px 20px rgba(0,0,0,.16);
}

.dashboard-theme .hero-system-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dashboard-theme .hero-system-brand-separator {
  width: 2px;
  height: 52px;
  flex: 0 0 2px;
}

/* Brand (22 + 142) + gap/divider + breathing room. */
.dashboard-theme .hero-copy,
.dashboard-theme .monitor-main-hero .hero-copy,
.dashboard-theme .production-monitor-main-hero .hero-copy {
  padding-left: 188px;
}

/* Monitor cards still reserve their original right-side space. */
.dashboard-theme .monitor-main-hero .hero-copy,
.dashboard-theme .production-monitor-main-hero .hero-copy {
  padding-right: 285px;
}

@media (max-width: 1180px) {
  .dashboard-theme .hero-system-brand,
  .dashboard-theme .monitor-main-hero .hero-system-brand {
    left: 18px;
    gap: 9px;
  }

  .dashboard-theme .hero-system-brand-mark {
    width: 124px;
    height: 52px;
    padding: 5px 8px;
  }

  .dashboard-theme .hero-system-brand-separator {
    height: 44px;
  }

  .dashboard-theme .hero-copy,
  .dashboard-theme .monitor-main-hero .hero-copy,
  .dashboard-theme .production-monitor-main-hero .hero-copy {
    padding-left: 162px;
  }
}

@media (max-width: 900px) {
  .dashboard-theme .hero-system-brand,
  .dashboard-theme .monitor-main-hero .hero-system-brand {
    top: 18px;
    left: 14px;
    right: auto;
    gap: 7px;
    transform: none;
  }

  .dashboard-theme .hero-system-brand-mark {
    width: 106px;
    height: 43px;
    padding: 4px 6px;
    border-radius: 10px;
  }

  .dashboard-theme .hero-system-brand-separator {
    height: 36px;
  }

  .dashboard-theme .hero-copy,
  .dashboard-theme .monitor-main-hero .hero-copy,
  .dashboard-theme .production-monitor-main-hero .hero-copy {
    padding-left: 130px;
  }
}

@media (max-width: 620px) {
  .dashboard-theme .hero-system-brand-mark {
    width: 92px;
    height: 39px;
  }

  .dashboard-theme .hero-system-brand-separator {
    display: block;
    height: 32px;
  }

  .dashboard-theme .hero-copy,
  .dashboard-theme .monitor-main-hero .hero-copy,
  .dashboard-theme .production-monitor-main-hero .hero-copy {
    padding-left: 112px;
  }
}

/* ========================================================================== */
/* Delidips refinement v25 — purchase orders by supplier                     */
/* ========================================================================== */

@media (min-width: 1500px) {
  .dashboard-theme .purchase-compact-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.dashboard-theme .purchase-order-count-widget .purchase-mini-chart {
  gap: 9px;
  padding-top: 2px;
}

.dashboard-theme .purchase-order-count-loading {
  min-height: 118px;
}

.dashboard-theme .purchase-order-count-row {
  grid-template-columns: minmax(74px, .95fr) minmax(56px, 1.15fr) auto auto;
  gap: 6px;
}

.dashboard-theme .purchase-order-count-row .purchase-mini-label {
  font-size: .59rem;
}

.dashboard-theme .purchase-order-count-row .purchase-mini-track {
  height: 9px;
}

.dashboard-theme .purchase-order-count-row > strong {
  min-width: 42px;
  font-size: .60rem;
}

.dashboard-theme .purchase-order-count-open,
.dashboard-theme .purchase-supplier-order-list-open {
  min-height: 25px;
  border: 1px solid rgba(15, 24, 28, .16);
  border-radius: 999px;
  background: #fff;
  color: #172126;
  font: inherit;
  font-size: .58rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.dashboard-theme .purchase-order-count-open {
  min-width: 36px;
  padding: 3px 7px;
}

.dashboard-theme .purchase-supplier-order-list-open {
  padding: 5px 10px;
}

.dashboard-theme .purchase-order-count-open:hover,
.dashboard-theme .purchase-order-count-open:focus-visible,
.dashboard-theme .purchase-supplier-order-list-open:hover,
.dashboard-theme .purchase-supplier-order-list-open:focus-visible {
  border-color: rgba(229, 139, 31, .72);
  background: #fff8ec;
  outline: none;
  transform: translateY(-1px);
}

.dashboard-theme .purchase-supplier-order-list {
  display: grid;
  gap: 8px;
  max-height: min(610px, calc(100dvh - 220px));
  padding: 2px 4px 4px 0;
  overflow-y: auto;
}

.dashboard-theme .purchase-supplier-order-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid #e7e2d9;
  border-radius: 13px;
  background: #fffdf9;
}

.dashboard-theme .purchase-supplier-order-list-row > div {
  min-width: 0;
}

.dashboard-theme .purchase-supplier-order-list-row strong,
.dashboard-theme .purchase-supplier-order-list-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .purchase-supplier-order-list-row strong {
  color: #263036;
  font-size: .72rem;
}

.dashboard-theme .purchase-supplier-order-list-row small {
  margin-top: 3px;
  color: #7a8082;
  font-size: .61rem;
}

.dashboard-theme .purchase-supplier-order-list-row > span {
  min-width: 56px;
  color: #192329;
  font-size: .72rem;
  font-weight: 850;
  text-align: right;
}

.dashboard-theme .purchase-supplier-orders-modal-backdrop {
  z-index: 1700;
}

.dashboard-theme .purchase-supplier-orders-modal-card {
  width: min(1120px, calc(100vw - 48px));
  max-width: 1120px;
  max-height: calc(100dvh - 54px);
  padding: 20px;
  overflow: hidden;
}

.dashboard-theme .purchase-supplier-orders-modal-heading {
  margin-bottom: 12px;
}

.dashboard-theme .purchase-supplier-orders-modal-heading h2 {
  margin-top: 3px;
}

.dashboard-theme .purchase-supplier-orders-modal-heading p {
  margin: 4px 0 0;
  color: #737b7f;
  font-size: .72rem;
}

.dashboard-theme .purchase-supplier-orders-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.dashboard-theme .purchase-supplier-orders-meta > span {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  min-height: 31px;
  padding: 6px 10px;
  border: 1px solid #e4ded3;
  border-radius: 11px;
  background: #f7f3eb;
}

.dashboard-theme .purchase-supplier-orders-meta b {
  color: #172126;
  font-size: .76rem;
  font-weight: 900;
}

.dashboard-theme .purchase-supplier-orders-meta small {
  color: #777e81;
  font-size: .61rem;
}

.dashboard-theme .purchase-supplier-orders-table-wrap {
  max-height: min(620px, calc(100dvh - 225px));
  overflow: auto;
  border: 1px solid #e5dfd5;
  border-radius: 15px;
  background: #fff;
}

.dashboard-theme .purchase-supplier-orders-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: #30393e;
  font-size: .69rem;
}

.dashboard-theme .purchase-supplier-orders-table th,
.dashboard-theme .purchase-supplier-orders-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #eee9e0;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.dashboard-theme .purchase-supplier-orders-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f5f1e9;
  color: #687075;
  font-size: .60rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.dashboard-theme .purchase-supplier-orders-sort {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  width: 100%;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.dashboard-theme .purchase-supplier-orders-sort::after {
  content: "↕";
  color: #a0a6a8;
  font-size: .68rem;
  line-height: 1;
}

.dashboard-theme .purchase-supplier-orders-table th[aria-sort="ascending"] .purchase-supplier-orders-sort,
.dashboard-theme .purchase-supplier-orders-table th[aria-sort="descending"] .purchase-supplier-orders-sort {
  color: #172126;
}

.dashboard-theme .purchase-supplier-orders-table th[aria-sort="ascending"] .purchase-supplier-orders-sort::after {
  content: "↑";
  color: #206e49;
}

.dashboard-theme .purchase-supplier-orders-table th[aria-sort="descending"] .purchase-supplier-orders-sort::after {
  content: "↓";
  color: #206e49;
}

.dashboard-theme .purchase-supplier-orders-sort:hover,
.dashboard-theme .purchase-supplier-orders-sort:focus-visible {
  color: #206e49;
}

.dashboard-theme .purchase-supplier-orders-sort:focus-visible {
  border-radius: 4px;
  outline: 2px solid rgb(42 128 86 / 22%);
  outline-offset: 2px;
}

.dashboard-theme .purchase-supplier-orders-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-theme .purchase-supplier-orders-table tbody tr:hover td {
  background: #fffaf1;
}

.dashboard-theme .purchase-supplier-orders-table tbody tr.is-pending td:first-child {
  box-shadow: inset 3px 0 0 #efa23f;
}

.dashboard-theme .purchase-order-number-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #16232a;
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-color: rgba(229, 139, 31, .48);
  text-underline-offset: 3px;
  cursor: pointer;
}

.dashboard-theme .purchase-order-number-link:hover,
.dashboard-theme .purchase-order-number-link:focus-visible {
  color: #b86a0f;
  outline: none;
  text-decoration-color: currentColor;
}

.dashboard-theme .purchase-order-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .60rem;
  font-weight: 850;
}

.dashboard-theme .purchase-order-status.is-pending {
  border: 1px solid #efbd73;
  background: #fff4df;
  color: #9b5b0c;
}

.dashboard-theme .purchase-order-status.is-complete {
  border: 1px solid #b9d7c5;
  background: #eef8f1;
  color: #2e6943;
}

.dashboard-theme .purchase-order-traceability-button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 29px;
  padding: 5px 9px;
  border: 1px solid #206e49;
  border-radius: 999px;
  background: #206e49;
  color: #fff;
  font: inherit;
  font-size: .59rem;
  font-weight: 800;
  cursor: pointer;
}

.dashboard-theme .purchase-order-traceability-button .ui-icon {
  width: 13px;
  height: 13px;
}

.dashboard-theme .purchase-order-traceability-button:hover,
.dashboard-theme .purchase-order-traceability-button:focus-visible {
  background: #185a3b;
  border-color: #185a3b;
  outline: 2px solid rgb(42 128 86 / 22%);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .dashboard-theme .purchase-order-count-row {
    grid-template-columns: minmax(78px, 1fr) minmax(60px, 1.1fr) auto auto;
  }

  .dashboard-theme .purchase-supplier-orders-modal-card {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    padding: 14px;
  }

  .dashboard-theme .purchase-supplier-orders-table-wrap {
    max-height: calc(100dvh - 205px);
  }
}

/* Customer current accounts dashboard -------------------------------------- */
.dashboard-theme .customer-account-shell {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.dashboard-theme .customer-account-progressive-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px dashed rgba(15, 24, 34, .16);
  border-radius: 12px;
  background: rgba(255, 255, 255, .52);
  color: #53615e;
  font-size: .64rem;
  font-weight: 760;
  text-align: center;
}

.dashboard-theme .customer-account-progressive-state[hidden] {
  display: none !important;
}

.dashboard-theme .customer-account-progressive-state.is-overlay {
  position: absolute;
  inset: 6px;
  z-index: 5;
  min-height: 0;
  background: rgba(255, 255, 255, .9);
}

.dashboard-theme .customer-account-progressive-state.is-modal {
  margin-bottom: 9px;
}

.dashboard-theme .customer-account-progressive-state[data-state="error"] {
  border-style: solid;
}

.dashboard-theme .customer-account-progressive-spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border: 2px solid rgba(15, 24, 34, .16);
  border-top-color: #9e5c08;
  border-radius: 50%;
  animation: customer-account-progressive-spin .75s linear infinite;
}

.dashboard-theme .customer-account-progressive-retry {
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(15, 24, 34, .2);
  border-radius: 999px;
  background: #fff;
  color: #263039;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.dashboard-theme .customer-account-progressive-retry:focus-visible {
  outline: 2px solid rgba(216, 132, 16, .32);
  outline-offset: 2px;
}

.dashboard-theme .customer-account-shell.is-progressive-loading [data-customer-account-kpi] {
  display: inline-block;
  min-width: 76px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(15, 24, 34, .06), rgba(15, 24, 34, .13), rgba(15, 24, 34, .06));
  background-size: 200% 100%;
  color: transparent;
  animation: customer-account-progressive-shimmer 1.2s ease-in-out infinite;
}

.dashboard-theme .customer-account-shell.is-progressive-loading .customer-account-kpi.kpi-main [data-customer-account-kpi] {
  background-color: rgba(255, 255, 255, .12);
}

@keyframes customer-account-progressive-spin {
  to { transform: rotate(360deg); }
}

@keyframes customer-account-progressive-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-theme .customer-account-progressive-spinner,
  .dashboard-theme .customer-account-shell.is-progressive-loading [data-customer-account-kpi] {
    animation: none;
  }
}

.dashboard-theme .customer-account-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.dashboard-theme .customer-account-kpi-grid .customer-account-kpi {
  min-height: 86px;
  padding: 11px 13px;
  border-radius: 15px;
  display: flex;
  align-items: stretch;
}

.dashboard-theme .customer-account-kpi-body {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.dashboard-theme .customer-account-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(15, 24, 34, .1);
  background: rgba(17, 24, 28, .035);
  color: #15212a;
  flex: 0 0 auto;
}

.dashboard-theme .customer-account-kpi-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-theme .customer-account-kpi-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dashboard-theme .customer-account-kpi-copy > span {
  font-size: .64rem;
  line-height: 1.15;
}

.dashboard-theme .customer-account-kpi-copy > strong {
  margin-top: 4px;
  font-size: clamp(1.05rem, 1.45vw, 1.42rem);
  line-height: 1.08;
}

.dashboard-theme .customer-account-kpi-copy > small {
  margin-top: 4px;
  font-size: .59rem;
  line-height: 1.2;
}

.dashboard-theme .customer-account-kpi.is-overdue {
  border-color: rgba(216, 132, 16, .32);
  background: linear-gradient(145deg, #fffaf1, #fff5e4);
}

.dashboard-theme .customer-account-kpi.kpi-main .customer-account-kpi-icon {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.dashboard-theme .customer-account-kpi.kpi-main .customer-account-kpi-copy > span,
.dashboard-theme .customer-account-kpi.kpi-main .customer-account-kpi-copy > small {
  color: rgba(255, 255, 255, .72);
}

.dashboard-theme .customer-account-kpi.is-overdue .customer-account-kpi-icon {
  border-color: rgba(216, 132, 16, .24);
  background: rgba(216, 132, 16, .09);
  color: #9e5c08;
}


.dashboard-theme .customer-account-kpi.is-overdue .customer-account-kpi-copy > strong,
.dashboard-theme .customer-account-overdue-value {
  color: #9e5c08;
}

.dashboard-theme .customer-account-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
  min-width: 0;
}

.dashboard-theme .customer-account-chart-card,
.dashboard-theme .customer-account-table-card {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 15px;
}

.dashboard-theme .customer-account-chart-card {
  min-height: 234px;
  height: clamp(234px, 24.5vh, 264px);
  display: flex;
  flex-direction: column;
}

.dashboard-theme .customer-account-aging-card {
  position: relative;
}

.dashboard-theme .customer-account-chart-card .card-heading,
.dashboard-theme .customer-account-table-card .card-heading {
  margin-bottom: 5px;
  gap: 6px;
}

.dashboard-theme .customer-account-chart-card > .card-heading {
  align-items: flex-start;
  flex-wrap: nowrap;
}

.dashboard-theme .customer-account-chart-card > .card-heading > div:first-child,
.dashboard-theme .customer-account-table-card > .card-heading > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-theme .customer-account-chart-card .card-heading h2,
.dashboard-theme .customer-account-table-card .card-heading h2 {
  margin: 0;
  font-size: .95rem;
  line-height: 1.06;
}

.dashboard-theme .customer-account-chart-card .eyebrow,
.dashboard-theme .customer-account-table-card .eyebrow {
  font-size: .54rem;
}

.dashboard-theme .customer-account-chart-card .chart-insight,
.dashboard-theme .customer-account-table-card .chart-insight {
  margin-top: 1px;
  max-width: none;
  font-size: .58rem;
  line-height: 1.16;
}

.dashboard-theme .customer-account-chart-card .metric-chip,
.dashboard-theme .customer-account-table-card .metric-chip {
  min-height: 22px;
  padding: 3px 7px;
  font-size: .55rem;
}

.dashboard-theme .customer-account-heading-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  flex: 0 0 auto;
  align-self: flex-start;
}

.dashboard-theme .customer-account-chart-help {
  position: relative;
  flex: 0 0 auto;
}

.dashboard-theme .customer-account-chart-help > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(15, 24, 34, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: #34404a;
  font-size: .62rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.dashboard-theme .customer-account-chart-help > summary::-webkit-details-marker {
  display: none;
}

.dashboard-theme .customer-account-chart-help[open] > summary,
.dashboard-theme .customer-account-chart-help > summary:hover,
.dashboard-theme .customer-account-chart-help > summary:focus-visible {
  border-color: rgba(216, 132, 16, .46);
  background: #fff4df;
  color: #9e5c08;
  outline: none;
}

.dashboard-theme .customer-account-chart-help-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 12;
  width: min(310px, 76vw);
  padding: 9px 10px;
  border: 1px solid rgba(15, 24, 34, .13);
  border-radius: 11px;
  background: #fffdf8;
  box-shadow: 0 12px 30px rgba(20, 24, 28, .14);
  color: #53615e;
}

.dashboard-theme .customer-account-chart-help-popover strong {
  display: block;
  margin-bottom: 4px;
  color: #15212a;
  font-size: .68rem;
}

.dashboard-theme .customer-account-chart-help-popover p {
  margin: 0;
  font-size: .62rem;
  font-weight: 650;
  line-height: 1.42;
}

.dashboard-theme .customer-account-chart-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}

.dashboard-theme .customer-account-aging-card .customer-account-chart-wrap,
.dashboard-theme .customer-account-trend-card .customer-account-chart-wrap,
.dashboard-theme .customer-account-dso-card .customer-account-chart-wrap,
.dashboard-theme .customer-account-collections-card .customer-account-chart-wrap {
  overflow: hidden;
}

.dashboard-theme .customer-account-aging-card canvas,
.dashboard-theme .customer-account-trend-card canvas,
.dashboard-theme .customer-account-dso-card canvas,
.dashboard-theme .customer-account-collections-card canvas {
  width: 100% !important;
  height: 100% !important;
}

.dashboard-theme .customer-account-aging-actions {
  position: absolute;
  right: 12px;
  bottom: 8px;
  left: 12px;
  z-index: 9;
  height: 0;
}

.dashboard-theme .customer-account-aging-actions button {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 1px;
  height: 1px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  border-radius: 8px;
  background: #fff4df;
  color: #59636b;
  font: inherit;
  font-size: .62rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.dashboard-theme .customer-account-aging-actions button:focus-visible {
  width: auto;
  height: 34px;
  min-width: 150px;
  min-height: 34px;
  padding: 7px 12px;
  overflow: visible;
  clip: auto;
  clip-path: none;
  border-color: rgba(216, 132, 16, .48);
  border-style: solid;
  border-width: 1px;
  color: #8d5304;
  outline: 2px solid rgba(216, 132, 16, .22);
  outline-offset: 1px;
  transform: translateX(-50%);
  box-shadow: 0 8px 24px rgba(16, 18, 23, .16);
}

.dashboard-theme .customer-account-aging-actions button:disabled {
  cursor: default;
}

.dashboard-theme .customer-account-external-tooltip {
  position: absolute;
  top: 6px;
  z-index: 8;
  display: grid;
  gap: 2px;
  min-width: 132px;
  max-width: min(210px, 64%);
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(16, 18, 23, .94);
  box-shadow: 0 8px 20px rgba(16, 18, 23, .16);
  color: #fffaf1;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 90ms ease, transform 90ms ease;
  pointer-events: none;
}

.dashboard-theme .customer-account-external-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.dashboard-theme .customer-account-external-tooltip.is-right {
  right: 6px;
  left: auto;
}

.dashboard-theme .customer-account-external-tooltip.is-left {
  left: 6px;
  right: auto;
}

.dashboard-theme .customer-account-external-tooltip strong {
  margin-bottom: 1px;
  color: #fff;
  font-size: .66rem;
  font-weight: 900;
  line-height: 1.15;
}

.dashboard-theme .customer-account-external-tooltip span {
  color: rgba(255, 250, 241, .92);
  font-size: .6rem;
  font-weight: 760;
  line-height: 1.18;
}

.dashboard-theme .customer-account-external-tooltip span.is-secondary {
  color: rgba(255, 250, 241, .7);
  font-size: .56rem;
}

.dashboard-theme .customer-account-trend-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  min-height: 120px;
  padding: 14px;
  border: 1px dashed rgba(15, 24, 34, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .32);
  color: #53615e;
  text-align: center;
}

.dashboard-theme .customer-account-trend-unavailable strong {
  color: #15212a;
  font-size: .72rem;
}

.dashboard-theme .customer-account-trend-unavailable span {
  max-width: 220px;
  font-size: .61rem;
  line-height: 1.3;
}

.dashboard-theme .customer-account-debtors-card {
  grid-column: span 2;
}

.dashboard-theme .customer-account-collections-card {
  grid-column: span 1;
}

.dashboard-theme .customer-account-collection-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 3px;
}

.dashboard-theme .customer-account-collection-summary > span {
  min-width: 0;
  padding: 4px 5px;
  border: 1px solid rgba(15, 24, 34, .075);
  border-radius: 8px;
  background: rgba(255, 255, 255, .46);
}

.dashboard-theme .customer-account-collection-summary small,
.dashboard-theme .customer-account-collection-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .customer-account-collection-summary small {
  color: #7a8088;
  font-size: .47rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .035em;
}

.dashboard-theme .customer-account-collection-summary strong {
  margin-top: 2px;
  color: #20292e;
  font-size: .62rem;
  font-weight: 950;
  line-height: 1.05;
}

.dashboard-theme .customer-account-collection-summary > span:nth-child(2) strong,
.dashboard-theme .customer-account-collection-summary > span:nth-child(3) strong {
  color: #9e5c08;
}

.dashboard-theme .customer-account-collections-chart-wrap {
  min-height: 0;
}

.dashboard-theme .customer-account-debtors-card:not(.is-widget-maximized) .customer-account-debtors-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.dashboard-theme .customer-account-debtors-card:not(.is-widget-maximized) .customer-account-debtor-row:nth-child(odd) {
  border-right: 1px solid rgba(15, 24, 34, .065);
}

.dashboard-theme .customer-account-debtors-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(15, 24, 34, .08);
  border-radius: 11px;
  background: rgba(255, 255, 255, .42);
  scrollbar-width: thin;
}

.dashboard-theme .customer-account-debtor-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) minmax(105px, .72fr) minmax(118px, .82fr);
  gap: 8px;
  align-items: center;
  min-height: 45px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(15, 24, 34, .065);
}

.dashboard-theme .customer-account-debtor-row:last-child {
  border-bottom: 0;
}

.dashboard-theme .customer-account-debtor-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #11181c;
  color: #fff;
  font-size: .59rem;
  font-weight: 900;
  line-height: 1;
}

.dashboard-theme .customer-account-debtor-client {
  min-width: 0;
}

.dashboard-theme .customer-account-debtor-client > strong {
  display: block;
  overflow: hidden;
  color: #28313a;
  font-size: .66rem;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .customer-account-debtor-bar {
  height: 3px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17, 24, 28, .09);
}

.dashboard-theme .customer-account-debtor-bar > span {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: #11181c;
}

.dashboard-theme .customer-account-debtor-amount,
.dashboard-theme .customer-account-debtor-overdue {
  min-width: 0;
  text-align: right;
}

.dashboard-theme .customer-account-debtor-amount > span,
.dashboard-theme .customer-account-debtor-overdue > span {
  display: block;
  margin-bottom: 1px;
  color: #7a8088;
  font-size: .52rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.dashboard-theme .customer-account-debtor-amount > strong,
.dashboard-theme .customer-account-debtor-overdue > strong {
  display: block;
  overflow: hidden;
  font-size: .65rem;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .customer-account-debtor-overdue > strong {
  color: #9e5c08;
}

.dashboard-theme .customer-account-debtor-overdue > em {
  display: inline-flex;
  margin-top: 2px;
  padding: 1px 4px;
  border-radius: 999px;
  background: #fff3df;
  color: #9e5c08;
  font-size: .5rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
}

.dashboard-theme .customer-account-table-card {
  padding-bottom: 10px;
}

.dashboard-theme .customer-account-table-heading {
  align-items: flex-start;
}

.dashboard-theme .customer-account-table-heading-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

.dashboard-theme .customer-account-table-search {
  display: none;
  align-items: center;
  gap: 5px;
  width: 224px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(15, 24, 34, .13);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: #6b737a;
}

.dashboard-theme .customer-account-table-search .ui-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.dashboard-theme .customer-account-table-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #15212a;
  font: inherit;
  font-size: .67rem;
  font-weight: 700;
}

.dashboard-theme .customer-account-table-search input::placeholder {
  color: #8a9095;
  opacity: 1;
}

.dashboard-theme .customer-account-table-search:focus-within {
  border-color: rgba(216, 132, 16, .5);
  background: #fffdf9;
  box-shadow: 0 0 0 2px rgba(216, 132, 16, .08);
}

.dashboard-theme .customer-account-table-card.is-widget-maximized .customer-account-table-search {
  display: inline-flex;
}

.dashboard-theme .customer-account-table-wrap {
  max-height: clamp(260px, 34vh, 410px);
  overflow: auto;
  border: 1px solid rgba(15, 24, 34, .08);
  border-radius: 11px;
  scrollbar-width: thin;
}

.dashboard-theme .customer-account-table {
  width: 100%;
  min-width: 1150px;
  table-layout: fixed;
  font-size: .67rem;
}

.dashboard-theme .customer-account-table col.customer-account-col-client { width: 250px; }
.dashboard-theme .customer-account-table col.customer-account-col-balance { width: 130px; }
.dashboard-theme .customer-account-table col.customer-account-col-overdue { width: 130px; }
.dashboard-theme .customer-account-table col.customer-account-col-not-due { width: 120px; }
.dashboard-theme .customer-account-table col.customer-account-col-percent { width: 86px; }
.dashboard-theme .customer-account-table col.customer-account-col-limit { width: 130px; }
.dashboard-theme .customer-account-table col.customer-account-col-utilization { width: 105px; }
.dashboard-theme .customer-account-table col.customer-account-col-days { width: 92px; }
.dashboard-theme .customer-account-table col.customer-account-col-date { width: 107px; }

.dashboard-theme .customer-account-table th,
.dashboard-theme .customer-account-table td {
  padding: 6px 8px;
  line-height: 1.18;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-theme .customer-account-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfaf7;
  box-shadow: 0 1px 0 rgba(15, 24, 34, .08);
  font-size: .58rem;
}

.dashboard-theme .customer-account-table th button {
  min-height: 20px;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
}

.dashboard-theme .customer-account-table th button::after {
  width: 11px;
  height: 14px;
  min-height: 0;
  flex: 0 0 11px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #8d9198;
  background: transparent;
  content: "↕";
  font-size: .66rem;
  line-height: 14px;
  letter-spacing: 0;
  text-transform: none;
}

.dashboard-theme .customer-account-table th[aria-sort="ascending"] button::after {
  color: #b56b08;
  background: transparent;
  content: "↑";
}

.dashboard-theme .customer-account-table th[aria-sort="descending"] button::after {
  color: #b56b08;
  background: transparent;
  content: "↓";
}

.dashboard-theme .customer-account-table tbody tr.has-overdue {
  background: rgba(216, 132, 16, .035);
}

.dashboard-theme .customer-account-client-cell {
  min-width: 0;
  max-width: none;
}

.dashboard-theme .customer-account-client-content {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.dashboard-theme .customer-account-client-content > strong {
  min-width: 0;
}

.dashboard-theme .customer-account-client-content > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .customer-account-next-due {
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .customer-account-utilization {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 46px;
  padding: 2px 5px;
  border-radius: 999px;
  font-weight: 800;
}

.dashboard-theme .customer-account-utilization.is-warning {
  background: #fff4df;
  color: #9b5b0c;
}

.dashboard-theme .customer-account-utilization.is-critical {
  background: #fdebea;
  color: #a43a32;
}

.dashboard-theme .customer-account-empty {
  min-height: 96px;
  margin: 0;
  padding: 18px;
}

.dashboard-theme .customer-account-filter-grid {
  display: grid;
  grid-template-columns: minmax(150px, .72fr) minmax(190px, .95fr) minmax(130px, .62fr) minmax(300px, 1.7fr);
  gap: 9px;
  width: 100%;
  align-items: start;
}

.dashboard-theme .customer-account-filter-grid .filter-group {
  min-width: 0;
  margin: 0;
  padding: 9px 10px;
}

.dashboard-theme .customer-account-filter-grid .filter-heading {
  margin-bottom: 5px;
}

.dashboard-theme .customer-account-filter-grid .filter-select,
.dashboard-theme .customer-account-filter-grid .chip-search {
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.dashboard-theme .customer-account-client-filter .compact-search-list {
  max-height: 128px;
}

.dashboard-theme .customer-account-chart-card.is-widget-maximized {
  height: min(82vh, 780px);
  max-height: none;
}

.dashboard-theme .customer-account-chart-card.is-widget-maximized .customer-account-chart-wrap {
  min-height: 360px;
}

.dashboard-theme .customer-account-table-card.is-widget-maximized .customer-account-table-wrap {
  max-height: calc(100vh - 260px);
}

@media (max-width: 1500px) {
  .dashboard-theme .customer-account-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .customer-account-debtors-card,
  .dashboard-theme .customer-account-collections-card {
    grid-column: auto;
  }

  .dashboard-theme .customer-account-debtors-card:not(.is-widget-maximized) .customer-account-debtors-list {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .customer-account-debtors-card:not(.is-widget-maximized) .customer-account-debtor-row:nth-child(odd) {
    border-right: 0;
  }
}

@media (max-width: 1220px) {
  .dashboard-theme .customer-account-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-theme .customer-account-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .customer-account-dso-card,
  .dashboard-theme .customer-account-debtors-card,
  .dashboard-theme .customer-account-collections-card {
    grid-column: 1 / -1;
  }

  .dashboard-theme .customer-account-chart-card {
    height: 260px;
  }

  .dashboard-theme .customer-account-filter-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .dashboard-theme .customer-account-client-filter {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .customer-account-shell {
    gap: 8px;
  }

  .dashboard-theme .customer-account-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .dashboard-theme .customer-account-chart-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .customer-account-dso-card,
  .dashboard-theme .customer-account-debtors-card {
    grid-column: auto;
  }

  .dashboard-theme .customer-account-table-heading {
    flex-wrap: wrap;
  }

  .dashboard-theme .customer-account-table-heading-tools {
    width: 100%;
    margin-left: 0;
  }

  .dashboard-theme .customer-account-table-card.is-widget-maximized .customer-account-table-search {
    flex: 1 1 auto;
    width: auto;
    min-width: 150px;
  }

  .dashboard-theme .customer-account-kpi-grid .customer-account-kpi {
    min-height: 78px;
    padding: 9px 10px;
  }

  .dashboard-theme .customer-account-kpi-body {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
  }

  .dashboard-theme .customer-account-kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .dashboard-theme .customer-account-kpi-icon svg {
    width: 19px;
    height: 19px;
  }

  .dashboard-theme .customer-account-kpi-copy > strong {
    font-size: 1rem;
  }

  .dashboard-theme .customer-account-chart-card,
  .dashboard-theme .customer-account-table-card {
    padding: 10px;
  }

  .dashboard-theme .customer-account-chart-card {
    min-height: 245px;
    height: 260px;
  }

  .dashboard-theme .customer-account-chart-card .card-heading,
  .dashboard-theme .customer-account-table-card .card-heading {
    align-items: flex-start;
  }

  .dashboard-theme .customer-account-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .dashboard-theme .customer-account-client-filter {
    grid-column: 1 / -1;
  }

  .dashboard-theme .customer-account-table-wrap {
    max-height: 340px;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .customer-account-debtor-row {
    grid-template-columns: 22px minmax(0, 1fr) minmax(96px, .76fr);
    gap: 6px;
    padding: 6px;
  }

  .dashboard-theme .customer-account-debtor-overdue {
    grid-column: 2 / -1;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 5px;
    align-items: center;
    text-align: left;
  }

  .dashboard-theme .customer-account-debtor-overdue > span,
  .dashboard-theme .customer-account-debtor-overdue > strong,
  .dashboard-theme .customer-account-debtor-overdue > em {
    margin: 0;
  }

  .dashboard-theme .customer-account-debtor-overdue > strong {
    text-align: right;
  }
}

/* Customer current account drill-down -------------------------------------- */
.dashboard-theme .customer-account-client-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-theme .customer-account-client-link:hover .customer-account-client-content > span,
.dashboard-theme .customer-account-client-link:focus-visible .customer-account-client-content > span {
  color: #9e5c08;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dashboard-theme .customer-account-client-link:focus-visible {
  border-radius: 5px;
  outline: 2px solid rgba(216, 132, 16, .38);
  outline-offset: 2px;
}

.dashboard-theme .customer-account-client-drill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  color: #8b9298;
  font-size: .9rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 140ms ease, color 140ms ease, background 140ms ease;
}

.dashboard-theme .customer-account-client-link:hover .customer-account-client-drill,
.dashboard-theme .customer-account-client-link:focus-visible .customer-account-client-drill {
  background: #fff1da;
  color: #9e5c08;
  transform: translateX(2px);
}

.dashboard-theme .customer-account-detail-backdrop {
  z-index: 1210;
  padding: clamp(14px, 3vw, 34px);
}

.dashboard-theme .customer-account-detail-modal {
  width: min(1280px, calc(100vw - 42px));
  max-width: none;
  max-height: min(86vh, 820px);
  padding: 16px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.dashboard-theme .customer-account-detail-heading {
  margin: 0;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: flex-start;
}

.dashboard-theme .customer-account-detail-heading .eyebrow {
  font-size: .56rem;
}

.dashboard-theme .customer-account-detail-heading h2 {
  margin: 1px 0 0;
  font-size: 1.08rem;
  line-height: 1.08;
}

.dashboard-theme .customer-account-detail-heading p {
  margin: 3px 0 0;
  color: #667078;
  font-size: .65rem;
  font-weight: 700;
  line-height: 1.25;
}

.dashboard-theme .customer-account-detail-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.dashboard-theme .customer-account-detail-kpis article {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(15, 24, 34, .09);
  border-radius: 11px;
  background: #fbf8f1;
}

.dashboard-theme .customer-account-detail-kpis article.is-overdue {
  border-color: rgba(216, 132, 16, .24);
  background: #fff8ec;
}

.dashboard-theme .customer-account-detail-kpis span {
  display: block;
  color: #737b82;
  font-size: .55rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.dashboard-theme .customer-account-detail-kpis strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #11181c;
  font-size: .88rem;
  font-weight: 950;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .customer-account-detail-kpis article.is-overdue strong {
  color: #9e5c08;
}

.dashboard-theme .customer-account-detail-table-wrap {
  flex: 1 1 auto;
  min-height: 210px;
  overflow: auto;
  border: 1px solid rgba(15, 24, 34, .09);
  border-radius: 12px;
  scrollbar-width: thin;
}

.dashboard-theme .customer-account-detail-table {
  width: 100%;
  min-width: 1080px;
  table-layout: fixed;
  font-size: .68rem;
}

.dashboard-theme .customer-account-detail-table th,
.dashboard-theme .customer-account-detail-table td {
  padding: 7px 9px;
  line-height: 1.15;
  white-space: nowrap;
}

.dashboard-theme .customer-account-detail-table th:nth-child(1) { width: 105px; }
.dashboard-theme .customer-account-detail-table th:nth-child(2) { width: 220px; }
.dashboard-theme .customer-account-detail-table th:nth-child(3) { width: 100px; }
.dashboard-theme .customer-account-detail-table th:nth-child(4) { width: 108px; }
.dashboard-theme .customer-account-detail-table th:nth-child(5) { width: 82px; }
.dashboard-theme .customer-account-detail-table th:nth-child(6) { width: 120px; }
.dashboard-theme .customer-account-detail-table th:nth-child(7) { width: 120px; }
.dashboard-theme .customer-account-detail-table th:nth-child(8) { width: 125px; }
.dashboard-theme .customer-account-detail-table th:nth-child(9) { width: 95px; }

.dashboard-theme .customer-account-detail-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fbfaf7;
  box-shadow: 0 1px 0 rgba(15, 24, 34, .09);
  font-size: .57rem;
}

.dashboard-theme .customer-account-detail-table th button {
  min-height: 20px;
  gap: 4px;
  white-space: nowrap;
}

.dashboard-theme .customer-account-detail-table th button::after {
  content: "↕";
  margin-left: 4px;
  color: #969ca1;
  font-size: .64rem;
}

.dashboard-theme .customer-account-detail-table th[aria-sort="ascending"] button::after {
  content: "↑";
  color: #b56b08;
}

.dashboard-theme .customer-account-detail-table th[aria-sort="descending"] button::after {
  content: "↓";
  color: #b56b08;
}

.dashboard-theme .customer-account-detail-table tbody tr.is-overdue {
  background: rgba(216, 132, 16, .035);
}

.dashboard-theme .customer-account-detail-table tbody tr.is-credit {
  background: rgba(43, 122, 83, .035);
}

.dashboard-theme .customer-account-detail-reference {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-theme .customer-account-detail-reference-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 24px;
  padding: 2px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #25313a;
  font: inherit;
  font-weight: 850;
  line-height: 1.1;
  cursor: pointer;
}

.dashboard-theme .customer-account-detail-reference-button > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .customer-account-detail-reference-chevron {
  flex: 0 0 auto;
  color: #b56b08;
  font-size: .9rem;
  font-weight: 950;
  line-height: 1;
}

.dashboard-theme .customer-account-detail-reference-button:hover,
.dashboard-theme .customer-account-detail-reference-button:focus-visible,
.dashboard-theme .customer-account-detail-reference-button[aria-expanded="true"] {
  background: rgba(216, 132, 16, .1);
  color: #8b5200;
  outline: none;
}

.customer-account-document-action-menu {
  z-index: 4100;
}

.dashboard-theme .customer-account-detail-status {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef1f2;
  color: #4f5961;
  font-size: .56rem;
  font-weight: 900;
  line-height: 1;
}

.dashboard-theme .customer-account-detail-status.is-overdue {
  background: #fff0dc;
  color: #9e5c08;
}

.dashboard-theme .customer-account-detail-status.is-not-due {
  background: #edf2f3;
  color: #34404a;
}

.dashboard-theme .customer-account-detail-status.is-credit {
  background: #eaf5ef;
  color: #286f4d;
}

.dashboard-theme .customer-account-detail-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-top: 1px solid rgba(15, 24, 34, .1);
  background: #f6f1e7;
  font-weight: 900;
}

.dashboard-theme .customer-account-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed rgba(15, 24, 34, .14);
  border-radius: 12px;
  color: #697279;
  font-size: .72rem;
  font-weight: 750;
  text-align: center;
}

.dashboard-theme .customer-account-detail-empty[hidden],
.dashboard-theme .customer-account-detail-table-wrap[hidden] {
  display: none !important;
}

/* Aging bar drill-down ----------------------------------------------------- */
.dashboard-theme .customer-account-aging-drilldown-backdrop {
  z-index: 1210;
  padding: clamp(14px, 3vw, 34px);
}

.dashboard-theme .customer-account-aging-drilldown-modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(1180px, calc(100vw - 42px));
  max-width: none;
  height: min(86dvh, 820px);
  max-height: min(86vh, 820px);
  box-sizing: border-box;
  padding: 16px;
  overflow: hidden;
  border-radius: 20px;
}

.dashboard-theme .customer-account-aging-drilldown-heading-copy {
  min-width: 0;
}

.dashboard-theme .customer-account-aging-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  margin: 0 0 5px;
  padding: 4px 8px;
  border: 1px solid rgba(15, 24, 34, .13);
  border-radius: 8px;
  background: #f8f5ee;
  color: #3d484f;
  font: inherit;
  font-size: .62rem;
  font-weight: 900;
  cursor: pointer;
}

.dashboard-theme .customer-account-aging-back:hover,
.dashboard-theme .customer-account-aging-back:focus-visible {
  border-color: rgba(216, 132, 16, .45);
  background: #fff3df;
  color: #8d5304;
  outline: 2px solid rgba(216, 132, 16, .2);
  outline-offset: 1px;
}

.dashboard-theme .customer-account-aging-back[hidden],
.dashboard-theme .customer-account-aging-bucket-view[hidden],
.dashboard-theme .customer-account-aging-customer-view[hidden],
.dashboard-theme .customer-account-aging-empty[hidden],
.dashboard-theme .customer-account-aging-customers-wrap[hidden] {
  display: none !important;
}

.dashboard-theme .customer-account-aging-bucket-view,
.dashboard-theme .customer-account-aging-customer-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.dashboard-theme .customer-account-aging-customers-wrap,
.dashboard-theme .customer-account-aging-movements-wrap {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(15, 24, 34, .09);
  border-radius: 12px;
  scrollbar-width: thin;
}

.dashboard-theme .customer-account-aging-customers-table,
.dashboard-theme .customer-account-aging-movements-table {
  width: 100%;
  font-size: .68rem;
}

.dashboard-theme .customer-account-aging-customers-table {
  min-width: 650px;
}

.dashboard-theme .customer-account-aging-movements-table {
  min-width: 1080px;
  table-layout: fixed;
}

.dashboard-theme .customer-account-aging-customers-table th,
.dashboard-theme .customer-account-aging-customers-table td,
.dashboard-theme .customer-account-aging-movements-table th,
.dashboard-theme .customer-account-aging-movements-table td {
  padding: 8px 10px;
  line-height: 1.18;
  white-space: nowrap;
}

.dashboard-theme .customer-account-aging-customers-table thead th,
.dashboard-theme .customer-account-aging-movements-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fbfaf7;
  box-shadow: 0 1px 0 rgba(15, 24, 34, .09);
  font-size: .58rem;
}

/* Keep the movement table's sort state compact and directional. The
   aria-sort attribute remains the accessible source of truth. */
.dashboard-theme .customer-account-aging-movements-table th button {
  min-height: 20px;
  gap: 4px;
  white-space: nowrap;
}

.dashboard-theme .customer-account-aging-movements-table th button::after {
  content: "↕";
  margin-left: 4px;
  color: #969ca1;
  font-size: .7rem;
  line-height: 1;
}

.dashboard-theme .customer-account-aging-movements-table th[aria-sort="ascending"] button::after {
  content: "↑";
  color: #b56b08;
}

.dashboard-theme .customer-account-aging-movements-table th[aria-sort="descending"] button::after {
  content: "↓";
  color: #b56b08;
}

.dashboard-theme .customer-account-aging-customer-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #25313a;
  font: inherit;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.dashboard-theme .customer-account-aging-customer-button:hover,
.dashboard-theme .customer-account-aging-customer-button:focus-visible {
  background: rgba(216, 132, 16, .1);
  color: #8b5200;
  outline: 2px solid rgba(216, 132, 16, .2);
  outline-offset: 1px;
}

.dashboard-theme .customer-account-aging-customer-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .customer-account-aging-customer-button span:last-child {
  color: #b56b08;
  font-size: .95rem;
}

.dashboard-theme .customer-account-aging-movements-table th:nth-child(1) { width: 105px; }
.dashboard-theme .customer-account-aging-movements-table th:nth-child(2) { width: 220px; }
.dashboard-theme .customer-account-aging-movements-table th:nth-child(3),
.dashboard-theme .customer-account-aging-movements-table th:nth-child(4),
.dashboard-theme .customer-account-aging-movements-table th:nth-child(5) { width: 100px; }
.dashboard-theme .customer-account-aging-movements-table th:nth-child(6),
.dashboard-theme .customer-account-aging-movements-table th:nth-child(7),
.dashboard-theme .customer-account-aging-movements-table th:nth-child(8) { width: 120px; }
.dashboard-theme .customer-account-aging-movements-table th:nth-child(9) { width: 95px; }

.dashboard-theme .customer-account-aging-movements-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-top: 1px solid rgba(15, 24, 34, .1);
  background: #f6f1e7;
  font-weight: 900;
}

.dashboard-theme .customer-account-aging-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 24px;
  border: 1px dashed rgba(15, 24, 34, .14);
  border-radius: 12px;
  color: #697279;
  font-size: .72rem;
  font-weight: 750;
  text-align: center;
}

@media (max-width: 760px) {
  .dashboard-theme .customer-account-detail-backdrop {
    padding: 8px;
  }

  .dashboard-theme .customer-account-detail-modal {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 12px;
    border-radius: 16px;
  }

  .dashboard-theme .customer-account-detail-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .customer-account-aging-drilldown-backdrop {
    padding: 8px;
  }

  .dashboard-theme .customer-account-aging-drilldown-modal {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 12px;
    border-radius: 16px;
  }

}

@media (max-height: 560px) {
  .dashboard-theme .customer-account-aging-drilldown-backdrop {
    padding: 6px;
  }

  .dashboard-theme .customer-account-aging-drilldown-modal {
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    gap: 6px;
    padding: 10px;
  }

  .dashboard-theme .customer-account-aging-summary article {
    padding-block: 6px;
  }
}

/* ========================================================================== */
/* Delidips refinement v25 — modal Cobranza vs. vencimientos                  */
/* ========================================================================== */

/*
   El gráfico de cobranzas necesita una proporción más horizontal que el resto
   de los widgets. El card conserva su diseño compacto en el dashboard y sólo
   cambia cuando se abre dentro del modal de maximización.
*/
.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized {
  width: min(1180px, calc(100vw - 72px)) !important;
  max-width: 1180px !important;
  height: min(68dvh, 660px) !important;
  min-height: 520px !important;
  max-height: calc(100dvh - 48px) !important;
  padding: 18px 22px 20px !important;
  overflow: hidden !important;
}

/* Cabecera más legible, sin consumir altura innecesaria. */
.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized > .card-heading {
  flex: 0 0 auto;
  min-height: 0;
  margin-bottom: 8px;
  padding-right: 92px;
  gap: 10px;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized > .card-heading h2 {
  font-size: 1.08rem;
  line-height: 1.08;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized > .card-heading .eyebrow {
  margin-bottom: 5px;
  font-size: .62rem;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized > .card-heading .chart-insight {
  margin-top: 2px;
  font-size: .64rem;
  line-height: 1.25;
}

/* Los indicadores superiores aprovechan el nuevo ancho del modal. */
.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-collection-summary {
  flex: 0 0 auto;
  gap: 8px;
  margin: 0 0 7px;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-collection-summary > span {
  padding: 6px 9px;
  border-radius: 9px;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-collection-summary small {
  font-size: .52rem;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-collection-summary strong {
  margin-top: 3px;
  font-size: .70rem;
}

/*
   El canvas ocupa sólo el espacio restante. Se anula el min-height genérico de
   360px para evitar que fuerce un modal excesivamente alto en viewports bajos.
*/
.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-chart-wrap,
.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-collections-chart-wrap {
  flex: 1 1 auto;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

/* Notebook / viewport intermedio. */
@media (max-width: 1200px) {
  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized {
    width: calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px) !important;
    height: min(70dvh, 620px) !important;
    min-height: 480px !important;
    padding: 16px 18px 18px !important;
  }
}

/* Mobile y pantallas angostas: el modal pasa a utilizar casi todo el viewport. */
@media (max-width: 760px) {
  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    height: calc(100dvh - 20px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 20px) !important;
    padding: 14px !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized > .card-heading {
    padding-right: 72px;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-collection-summary {
    gap: 5px;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-chart-wrap,
  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-collections-chart-wrap {
    flex: 0 0 320px;
    min-height: 320px !important;
  }
}

/* Landscape muy bajo: prioriza que el contenido pueda desplazarse sin recorte. */
@media (max-height: 560px) {
  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized {
    height: calc(100dvh - 20px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 20px) !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-chart-wrap,
  .dashboard-theme .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-collections-chart-wrap {
    flex: 0 0 300px;
    min-height: 300px !important;
  }
}

/* ========================================================================== */
/* Delidips refinement v26 — modales horizontales para Aging y calendario AP  */
/* ========================================================================== */

/*
   Los otros gráficos de cuentas corrientes (por ejemplo Aging de cuentas a pagar
   y Calendario de vencimientos) seguían heredando la altura genérica de 82vh y
   un min-height fijo para el chart wrap. Eso los hacía verse angostos y altos.
   Esta regla los convierte en modales más horizontales y reparte mejor el espacio
   entre cabecera y gráfico.
*/
.dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) {
  width: min(var(--widget-modal-width, 1080px), calc(100vw - 52px)) !important;
  max-width: 1080px !important;
  min-height: 0 !important;
  height: min(68dvh, 560px) !important;
  max-height: calc(100dvh - 56px) !important;
  padding: 16px 18px 18px !important;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) > .card-heading {
  flex: 0 0 auto;
  min-height: 0;
  margin-bottom: 4px;
  padding-right: 92px;
  gap: 8px;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) > .card-heading h2 {
  font-size: 1.08rem;
  line-height: 1.08;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) > .card-heading .eyebrow {
  margin-bottom: 5px;
  font-size: .62rem;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) > .card-heading .chart-insight {
  margin-top: 2px;
  font-size: .64rem;
  line-height: 1.24;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) .customer-account-chart-wrap {
  flex: 1 1 auto;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

/* El Aging necesita un poco más de aire inferior para las etiquetas de buckets. */
.dashboard-theme .widget-modal-backdrop > .customer-account-aging-card.is-widget-maximized .customer-account-chart-wrap {
  padding-bottom: 2px;
}

@media (max-width: 1200px) {
  .dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) {
    width: calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px) !important;
    height: min(66dvh, 540px) !important;
    padding: 15px 16px 16px !important;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    height: calc(100dvh - 20px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 20px) !important;
    padding: 14px !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) > .card-heading {
    padding-right: 72px;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) .customer-account-chart-wrap {
    flex: 0 0 320px;
    min-height: 320px !important;
  }
}

@media (max-height: 620px) {
  .dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) {
    height: calc(100dvh - 20px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 20px) !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.is-widget-maximized:not(.customer-account-collections-card) .customer-account-chart-wrap {
    flex: 0 0 300px;
    min-height: 300px !important;
  }
}

/* Supplier accounts · monthly purchases vs payments ------------------------ */
.dashboard-theme .supplier-purchase-payment-card {
  position: relative;
  min-width: 0;
  min-height: 342px;
  height: clamp(342px, 38vh, 410px);
  padding: 14px 16px 12px;
  border-radius: 17px;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.dashboard-theme .supplier-purchase-payment-heading {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 8px;
}

.dashboard-theme .supplier-purchase-payment-heading > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-theme .supplier-purchase-payment-heading .eyebrow {
  color: #d88410;
}

.dashboard-theme .supplier-purchase-payment-heading h2 {
  margin: 2px 0 0;
  font-size: 1rem;
  line-height: 1.08;
}

.dashboard-theme .supplier-purchase-payment-heading .chart-insight {
  margin-top: 3px;
  max-width: 760px;
  font-size: .62rem;
  line-height: 1.25;
}

.dashboard-theme .supplier-purchase-payment-heading-tools {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  margin-left: auto;
}

.dashboard-theme .supplier-purchase-payment-period {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dashboard-theme .supplier-purchase-payment-period select {
  min-width: 94px;
  height: 30px;
  padding: 0 29px 0 11px;
  border: 1px solid rgba(15, 24, 34, .14);
  border-radius: 999px;
  color: #20292e;
  background: rgba(255, 253, 248, .92);
  font: inherit;
  font-size: .63rem;
  font-weight: 850;
  cursor: pointer;
}

.dashboard-theme .supplier-purchase-payment-period select:hover,
.dashboard-theme .supplier-purchase-payment-period select:focus-visible {
  border-color: rgba(216, 132, 16, .5);
  outline: 2px solid rgba(216, 132, 16, .16);
  outline-offset: 1px;
}

.dashboard-theme .supplier-purchase-payment-help > summary {
  width: 28px;
  height: 28px;
  font-size: .7rem;
}

.dashboard-theme .supplier-purchase-payment-topline {
  display: grid;
  grid-template-columns: minmax(290px, .9fr) minmax(450px, 1.1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  margin-bottom: 7px;
}

.dashboard-theme .supplier-purchase-payment-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  min-width: 0;
  padding-left: 2px;
  color: #3f474e;
  font-size: .61rem;
  font-weight: 800;
}

.dashboard-theme .supplier-purchase-payment-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dashboard-theme .supplier-purchase-payment-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.dashboard-theme .supplier-purchase-payment-legend i.is-invoiced {
  background: #172126;
}

.dashboard-theme .supplier-purchase-payment-legend i.is-paid {
  background: #e88a00;
}

.dashboard-theme .supplier-purchase-payment-legend i.is-net {
  position: relative;
  width: 19px;
  height: 2px;
  border-radius: 999px;
  background: #8b9195;
}

.dashboard-theme .supplier-purchase-payment-legend i.is-net::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border: 1px solid #fffaf1;
  border-radius: 999px;
  background: #8b9195;
  transform: translate(-50%, -50%);
}

.dashboard-theme .supplier-purchase-payment-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  border: 1px solid rgba(15, 24, 34, .085);
  border-radius: 12px;
  background: rgba(255, 255, 255, .46);
  overflow: hidden;
}

.dashboard-theme .supplier-purchase-payment-summary > span {
  position: relative;
  min-width: 0;
  padding: 7px 10px 6px;
}

.dashboard-theme .supplier-purchase-payment-summary > span + span::before {
  content: '';
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 0;
  width: 1px;
  background: rgba(15, 24, 34, .09);
}

.dashboard-theme .supplier-purchase-payment-summary small,
.dashboard-theme .supplier-purchase-payment-summary strong,
.dashboard-theme .supplier-purchase-payment-summary em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .supplier-purchase-payment-summary small {
  color: #707684;
  font-size: .49rem;
  font-weight: 800;
  line-height: 1;
}

.dashboard-theme .supplier-purchase-payment-summary strong {
  margin-top: 3px;
  color: #182126;
  font-size: .75rem;
  font-weight: 950;
  line-height: 1.06;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .supplier-purchase-payment-summary strong.is-net {
  color: #d88410;
}

.dashboard-theme .supplier-purchase-payment-summary em {
  margin-top: 3px;
  color: #7a8088;
  font-size: .45rem;
  font-style: normal;
  font-weight: 750;
}

.dashboard-theme .supplier-purchase-payment-chart-shell {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.dashboard-theme .supplier-purchase-payment-axis-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 3px;
  color: #5f6870;
  font-size: .5rem;
  font-weight: 800;
}

.dashboard-theme .supplier-purchase-payment-chart-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
  overflow: hidden;
}

.dashboard-theme .supplier-purchase-payment-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.dashboard-theme .supplier-purchase-payment-state {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 1px dashed rgba(15, 24, 34, .11);
  border-radius: 10px;
  background: rgba(255, 253, 248, .9);
  color: #68706c;
  font-size: .63rem;
  font-weight: 800;
  text-align: center;
}

.dashboard-theme .supplier-purchase-payment-state[hidden] {
  display: none;
}

.dashboard-theme .supplier-purchase-payment-detail-card {
  width: min(1040px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 36px));
}

.dashboard-theme .supplier-purchase-payment-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.dashboard-theme .supplier-purchase-payment-detail-summary > span {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid rgba(15, 24, 34, .09);
  border-radius: 11px;
  background: rgba(255, 255, 255, .48);
}

.dashboard-theme .supplier-purchase-payment-detail-summary small,
.dashboard-theme .supplier-purchase-payment-detail-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .supplier-purchase-payment-detail-summary small {
  color: #707684;
  font-size: .61rem;
  font-weight: 800;
}

.dashboard-theme .supplier-purchase-payment-detail-summary strong {
  margin-top: 3px;
  color: #1d262b;
  font-size: .84rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .supplier-purchase-payment-detail-state {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px dashed rgba(15, 24, 34, .14);
  border-radius: 11px;
  color: #68706c;
  background: rgba(255, 255, 255, .4);
  font-size: .75rem;
  font-weight: 800;
  text-align: center;
}

.dashboard-theme .supplier-purchase-payment-detail-state[hidden] {
  display: none;
}

.dashboard-theme .supplier-purchase-payment-detail-table-wrap {
  max-height: min(520px, calc(100vh - 300px));
  overflow: auto;
  border: 1px solid rgba(15, 24, 34, .09);
  border-radius: 12px;
}

.dashboard-theme .supplier-purchase-payment-detail-table {
  width: 100%;
}

.dashboard-theme .supplier-purchase-payment-detail-table td,
.dashboard-theme .supplier-purchase-payment-detail-table th {
  padding-top: 9px;
  padding-bottom: 9px;
}

.dashboard-theme .supplier-purchase-payment-detail-table td:nth-child(1) {
  width: 108px;
  white-space: nowrap;
}

.dashboard-theme .supplier-purchase-payment-detail-table td:nth-child(4) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized {
  width: var(--widget-modal-width, min(1320px, calc(100vw - 48px)));
  height: min(82vh, 780px);
  max-height: min(82vh, 780px);
  padding: 18px 20px 16px;
}

.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-wrap {
  min-height: 390px;
}

.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-heading h2 {
  font-size: 1.25rem;
}

.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-heading .chart-insight {
  font-size: .72rem;
}

.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-summary strong {
  font-size: .92rem;
}

@media (max-width: 1100px) {
  .dashboard-theme .supplier-purchase-payment-card {
    height: 430px;
  }

  .dashboard-theme .supplier-purchase-payment-topline {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .supplier-purchase-payment-legend {
    order: 2;
  }

  .dashboard-theme .supplier-purchase-payment-summary {
    order: 1;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .supplier-purchase-payment-card {
    height: 480px;
    padding: 11px 12px 10px;
  }

  .dashboard-theme .supplier-purchase-payment-heading {
    flex-wrap: wrap;
  }

  .dashboard-theme .supplier-purchase-payment-heading-tools {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .dashboard-theme .supplier-purchase-payment-summary > span {
    padding-inline: 7px;
  }

  .dashboard-theme .supplier-purchase-payment-summary strong {
    font-size: .64rem;
  }

  .dashboard-theme .supplier-purchase-payment-legend {
    gap: 10px;
    font-size: .54rem;
  }

  .dashboard-theme .supplier-purchase-payment-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .supplier-purchase-payment-detail-table-wrap {
    max-height: calc(100vh - 350px);
  }

  .dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized {
    width: calc(100vw - 20px);
    height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
    padding: 13px;
  }

  .dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-wrap {
    min-height: 280px;
  }
}

/* Supplier accounts · swapped chart placement ----------------------------- */
/* Aging now occupies the wide featured slot previously used by purchases/payments. */
.dashboard-theme .customer-account-aging-featured-card:not(.is-widget-maximized) {
  min-width: 0;
  min-height: 234px;
  height: clamp(234px, 24.5vh, 264px);
  padding: 10px 12px;
  border-radius: 17px;
}

.dashboard-theme .customer-account-aging-featured-card:not(.is-widget-maximized) > .card-heading {
  margin-bottom: 8px;
  gap: 14px;
}

.dashboard-theme .customer-account-aging-featured-card:not(.is-widget-maximized) > .card-heading h2 {
  font-size: 1rem;
  line-height: 1.08;
}

.dashboard-theme .customer-account-aging-featured-card:not(.is-widget-maximized) > .card-heading .eyebrow {
  font-size: .58rem;
}

.dashboard-theme .customer-account-aging-featured-card:not(.is-widget-maximized) > .card-heading .chart-insight {
  margin-top: 3px;
  max-width: 760px;
  font-size: .62rem;
  line-height: 1.25;
}

.dashboard-theme .customer-account-aging-featured-card:not(.is-widget-maximized) > .card-heading .metric-chip {
  min-height: 28px;
  padding: 5px 10px;
  font-size: .6rem;
}

.dashboard-theme .customer-account-aging-featured-card:not(.is-widget-maximized) .customer-account-chart-help > summary {
  width: 28px;
  height: 28px;
  font-size: .7rem;
}

/* Purchases/payments now behaves like the compact chart that occupied the Aging slot. */
.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) {
  min-width: 0;
  min-height: 234px;
  height: clamp(234px, 24.5vh, 264px);
  padding: 10px 12px;
  border-radius: 15px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-heading {
  gap: 6px;
  margin-bottom: 4px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-heading h2 {
  margin-top: 0;
  font-size: .95rem;
  line-height: 1.06;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-heading .eyebrow {
  font-size: .54rem;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-heading .chart-insight {
  margin-top: 1px;
  font-size: .56rem;
  line-height: 1.16;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-heading-tools {
  gap: 5px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-period select {
  min-width: 76px;
  height: 22px;
  padding: 0 23px 0 8px;
  font-size: .53rem;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-help > summary {
  width: 20px;
  height: 20px;
  font-size: .62rem;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-topline {
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 3px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-summary {
  order: 1;
  border-radius: 8px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-summary > span {
  padding: 4px 5px 3px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-summary > span + span::before {
  top: 4px;
  bottom: 4px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-summary small {
  font-size: .4rem;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-summary strong {
  margin-top: 2px;
  font-size: .57rem;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-summary em {
  margin-top: 2px;
  font-size: .37rem;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-legend {
  order: 2;
  gap: 8px;
  padding-left: 1px;
  font-size: .45rem;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-legend > span {
  gap: 4px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-legend i {
  width: 7px;
  height: 7px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-legend i.is-net {
  width: 15px;
  height: 2px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-axis-labels {
  padding-bottom: 1px;
  font-size: .4rem;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-chart-wrap {
  min-height: 0;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-state {
  padding: 10px;
  font-size: .56rem;
}

@media (max-width: 1220px) {
  .dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) {
    min-height: 260px;
    height: 260px;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .customer-account-aging-featured-card:not(.is-widget-maximized) {
    min-height: 245px;
    height: 260px;
    padding: 11px 12px 10px;
  }

  .dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) {
    min-height: 245px;
    height: 260px;
    padding: 10px;
  }

  .dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-heading {
    flex-wrap: wrap;
  }

  .dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-heading-tools {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Supplier purchases/payments — compact control alignment and modal viewport */
/* The selector/help pair uses the header's action lane, kept clear of both the
   injected widget controls and the heading copy. Its popover opens laterally in
   that header area, never over the summary or chart. */
.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) > .supplier-purchase-payment-heading {
  padding-right: 190px;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-heading-tools {
  position: absolute;
  top: -2px;
  right: 88px;
  z-index: 2;
  margin-left: 0;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-help {
  position: relative;
  z-index: 4;
}

.dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-help .customer-account-chart-help-popover {
  top: 0;
  right: calc(100% + 8px);
  width: min(280px, calc(100vw - 40px));
}

/* The generic compact-modal rule uses fit-content. This chart needs a bounded
   flex viewport instead, otherwise its canvas collapses or overflows on maximize. */
.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized {
  width: min(var(--widget-modal-width, 1320px), calc(100vw - 48px)) !important;
  min-height: 0 !important;
  height: min(82dvh, 780px) !important;
  max-height: calc(100dvh - 56px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-shell,
.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-wrap {
  min-height: 0 !important;
}

.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-shell {
  flex: 1 1 auto;
}

.dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-wrap {
  flex: 1 1 auto;
}

/* Supplier accounts · expanded trend ------------------------------------- */
/* The compact trend preview sits in a narrow dashboard column. In the modal,
   reserve a deliberately landscape viewport so the 12 monthly cuts gain both
   horizontal separation and a taller plotting area without altering clients. */
.dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.supplier-account-trend-card.is-widget-maximized:not(.customer-account-collections-card) {
  width: min(var(--widget-modal-width, 1240px), calc(100vw - 48px)) !important;
  max-width: 1240px !important;
  height: min(76dvh, 700px) !important;
  max-height: calc(100dvh - 56px) !important;
}

@media (max-width: 760px) {
  .dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-heading-tools {
    position: static;
    width: 100%;
    margin-top: -2px;
  }

  .dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) > .supplier-purchase-payment-heading {
    padding-right: 0;
  }

  .dashboard-theme .customer-account-chart-grid > .supplier-purchase-payment-card:not(.is-widget-maximized) .supplier-purchase-payment-help .customer-account-chart-help-popover {
    top: calc(100% + 5px);
    right: 0;
  }

  .dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    height: calc(100dvh - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-shell {
    flex: 0 0 280px;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.supplier-account-trend-card.is-widget-maximized:not(.customer-account-collections-card) {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    height: calc(100dvh - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    overflow-y: auto !important;
  }
}

@media (max-height: 620px) {
  .dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized {
    height: calc(100dvh - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-shell {
    flex: 0 0 250px;
  }

  .dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.supplier-account-trend-card.is-widget-maximized:not(.customer-account-collections-card) {
    height: calc(100dvh - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    overflow-y: auto !important;
  }
}

/* Supplier accounts · compact DPO card beside Top Creditors */
.dashboard-theme .supplier-account-dpo-card {
  grid-column: span 1;
}

.dashboard-theme .supplier-account-dpo-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) repeat(2, minmax(0, .92fr));
  gap: 0;
  min-height: 44px;
  margin: 0 0 2px;
  overflow: hidden;
  border: 1px solid rgba(15, 24, 34, .08);
  border-radius: 10px;
  background: rgba(255, 255, 255, .48);
}

.dashboard-theme .supplier-account-dpo-summary > div {
  min-width: 0;
  padding: 4px 7px;
}

.dashboard-theme .supplier-account-dpo-summary > div + div {
  position: relative;
}

.dashboard-theme .supplier-account-dpo-summary > div + div::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 1px;
  background: rgba(15, 24, 34, .08);
}

.dashboard-theme .supplier-account-dpo-metric {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-theme .supplier-account-dpo-metric-value {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  flex: 0 0 auto;
  color: #11181c;
  line-height: 1;
}

.dashboard-theme .supplier-account-dpo-metric-value b {
  font-size: .92rem;
  font-weight: 950;
  letter-spacing: -.03em;
}

.dashboard-theme .supplier-account-dpo-primary .supplier-account-dpo-metric-value b {
  font-size: 1.06rem;
}

.dashboard-theme .supplier-account-dpo-metric-value small {
  color: #59616a;
  font-size: .44rem;
  font-weight: 850;
  white-space: nowrap;
}

.dashboard-theme .supplier-account-dpo-metric-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dashboard-theme .supplier-account-dpo-metric-copy > span {
  display: block;
  overflow: hidden;
  color: #747b80;
  font-size: .43rem;
  font-weight: 850;
  line-height: 1.05;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: .035em;
  white-space: nowrap;
}

.dashboard-theme .supplier-account-dpo-metric-copy > em {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: #6d747b;
  font-size: .42rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .supplier-account-dpo-primary > .supplier-account-dpo-metric-copy > em[data-direction="up"] {
  color: #9e5c08;
}

.dashboard-theme .supplier-account-dpo-primary > .supplier-account-dpo-metric-copy > em[data-direction="down"] {
  color: #3f5b50;
}

.dashboard-theme .supplier-account-dpo-chart-wrap {
  min-height: 126px;
  overflow: hidden;
}

.dashboard-theme .supplier-account-dpo-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.dashboard-theme .supplier-account-dpo-state {
  position: absolute;
  inset: 24px 8px 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px dashed rgba(15, 24, 34, .12);
  border-radius: 9px;
  background: rgba(255, 253, 248, .94);
  color: #687078;
  font-size: .55rem;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
}

.dashboard-theme .supplier-account-dpo-state[hidden] {
  display: none;
}

.dashboard-theme .supplier-account-dpo-card > .card-heading {
  margin-bottom: 3px;
}

.dashboard-theme .supplier-account-dpo-card > .card-heading h2 {
  margin-bottom: 0;
}

.dashboard-theme .supplier-account-dpo-card .chart-insight {
  display: none;
}

.dashboard-theme .supplier-account-dpo-card .customer-account-heading-meta {
  gap: 4px;
}

.dashboard-theme .supplier-account-dpo-card {
  overflow: hidden;
}

.dashboard-theme .widget-modal-backdrop > .customer-account-chart-card.supplier-account-dpo-card.is-widget-maximized {
  width: min(var(--widget-modal-width, 1080px), calc(100vw - 48px)) !important;
  max-width: calc(100vw - 48px) !important;
  height: min(74dvh, 720px) !important;
}

.dashboard-theme .supplier-account-dpo-card.is-widget-maximized {
  height: min(74dvh, 720px);
}

.dashboard-theme .supplier-account-dpo-card.is-widget-maximized .supplier-account-dpo-summary {
  max-width: none;
  min-height: 56px;
}

.dashboard-theme .supplier-account-dpo-card.is-widget-maximized .supplier-account-dpo-metric {
  gap: 8px;
}

.dashboard-theme .supplier-account-dpo-card.is-widget-maximized .supplier-account-dpo-metric-value b {
  font-size: 1.06rem;
}

.dashboard-theme .supplier-account-dpo-card.is-widget-maximized .supplier-account-dpo-primary .supplier-account-dpo-metric-value b {
  font-size: 1.22rem;
}

.dashboard-theme .supplier-account-dpo-card.is-widget-maximized .supplier-account-dpo-chart-wrap {
  min-height: 390px;
  flex: 1 1 auto;
}

@media (max-width: 760px) {
  .dashboard-theme .supplier-account-dpo-summary {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .supplier-account-dpo-summary > div {
    padding-inline: 7px;
  }

  .dashboard-theme .supplier-account-dpo-summary > div + div::before {
    top: 0;
    right: 8px;
    bottom: auto;
    left: 8px;
    width: auto;
    height: 1px;
  }

  .dashboard-theme .supplier-account-dpo-primary .supplier-account-dpo-metric-value b {
    font-size: 1rem;
  }
}


/* ========================================================================== */
/* Configuration · scheduled reports                                          */
/* ========================================================================== */

.dashboard-theme .configuration-user-fields {
  grid-template-columns: minmax(180px, .75fr) minmax(260px, 1fr) minmax(230px, .9fr);
  max-width: 1120px;
}

.dashboard-theme #config-panel-reports {
  --report-border: rgba(17, 24, 28, .09);
  --report-muted: #70787c;
  --report-surface: rgba(255, 255, 255, .66);
}

.dashboard-theme .configuration-reports-heading {
  margin-bottom: 10px;
}

.dashboard-theme .configuration-report-warning {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(216, 132, 16, .22);
  border-radius: 12px;
  background: rgba(255, 244, 223, .72);
  color: #70501f;
  font-size: .68rem;
}

.dashboard-theme .configuration-report-warning strong {
  color: #8c570a;
  font-size: .72rem;
}

.dashboard-theme .configuration-report-workspace {
  display: grid;
  gap: 10px;
}

.dashboard-theme .configuration-report-list-card {
  padding: 13px 14px;
  border: 1px solid var(--report-border);
  border-radius: 17px;
  background: rgba(251, 248, 241, .94);
}

.dashboard-theme .configuration-report-editor {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid rgba(216, 132, 16, .18);
  border-radius: 14px;
  background: rgba(255, 252, 246, .94);
  box-shadow: inset 3px 0 0 rgba(216, 132, 16, .72);
}

.dashboard-theme .configuration-report-editor[hidden] {
  display: none !important;
}

.dashboard-theme [data-report-browse][hidden] {
  display: none !important;
}

.dashboard-theme .configuration-report-workspace.is-report-editor-open .configuration-report-editor {
  margin-bottom: 0;
}

.dashboard-theme .configuration-report-editor-heading,
.dashboard-theme .configuration-report-list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dashboard-theme .configuration-report-list-tools,
.dashboard-theme .configuration-report-form-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.dashboard-theme .configuration-report-new-button {
  min-height: 34px;
  padding-inline: 12px;
  white-space: nowrap;
}

.dashboard-theme .configuration-report-new-button > span {
  margin-right: 3px;
  font-size: .92rem;
  line-height: 0;
}

.dashboard-theme .configuration-report-editor-heading h3,
.dashboard-theme .configuration-report-list-heading h3 {
  margin: 2px 0;
  color: #11181c;
  font-size: .96rem;
  font-weight: 900;
}

.dashboard-theme .configuration-report-editor-heading p,
.dashboard-theme .configuration-report-list-heading p {
  margin: 0;
  color: var(--report-muted);
  font-size: .66rem;
  line-height: 1.35;
}

.dashboard-theme .configuration-report-form-grid {
  display: grid;
  grid-template-columns: minmax(175px, .9fr) minmax(210px, 1fr) minmax(260px, 1.3fr) minmax(130px, .62fr) minmax(145px, .66fr) minmax(110px, .5fr);
  gap: 8px;
  align-items: start;
}

.dashboard-theme .configuration-report-form-grid > label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-theme .configuration-report-form-grid > label > span {
  color: #687176;
  font-size: .55rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dashboard-theme .configuration-report-form-grid select,
.dashboard-theme .configuration-report-form-grid input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid rgba(17, 24, 28, .13);
  border-radius: 10px;
  background: #fff;
  color: #17201f;
  font: inherit;
  font-size: .7rem;
  font-weight: 720;
}

.dashboard-theme .configuration-report-form-grid input[readonly] {
  background: rgba(17, 24, 28, .035);
  color: #697276;
}

.dashboard-theme .configuration-report-form-grid small {
  min-height: 15px;
  color: #7a8386;
  font-size: .53rem;
  line-height: 1.25;
}

.dashboard-theme .configuration-report-user-static {
  display: grid;
  align-content: center;
  min-height: 38px;
  padding: 5px 9px;
  border: 1px solid rgba(17, 24, 28, .1);
  border-radius: 10px;
  background: rgba(255, 255, 255, .7);
}

.dashboard-theme .configuration-report-user-static strong {
  font-size: .7rem;
}

.dashboard-theme .configuration-report-user-static span {
  overflow: hidden;
  color: #7a8386;
  font-size: .55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .configuration-report-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
}

.dashboard-theme .configuration-report-permission-note {
  color: #697276;
  font-size: .6rem;
  line-height: 1.3;
}

.dashboard-theme .configuration-report-permission-note.is-error {
  color: #9b5310;
  font-weight: 750;
}

.dashboard-theme .configuration-report-table-wrap {
  overflow: auto;
  border: 1px solid rgba(17, 24, 28, .07);
  border-radius: 12px;
  background: rgba(255, 255, 255, .55);
}

.dashboard-theme .configuration-report-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  font-size: .64rem;
}

.dashboard-theme .configuration-report-table th {
  padding: 8px 9px;
  border-bottom: 1px solid rgba(17, 24, 28, .08);
  background: rgba(17, 24, 28, .035);
  color: #6c7579;
  font-size: .52rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
}

.dashboard-theme .configuration-report-table td {
  padding: 8px 9px;
  border-bottom: 1px solid rgba(17, 24, 28, .06);
  color: #303a3d;
  vertical-align: middle;
}

.dashboard-theme .configuration-report-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-theme .configuration-report-table td > strong,
.dashboard-theme .configuration-report-table td > small {
  display: block;
}

.dashboard-theme .configuration-report-table td > small {
  margin-top: 2px;
  color: #7a8386;
  font-size: .54rem;
}

.dashboard-theme .configuration-report-type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dashboard-theme .configuration-report-type > strong {
  color: #263034;
  font-size: .61rem;
  font-weight: 800;
  line-height: 1.22;
}

.dashboard-theme .configuration-report-type-icon {
  display: inline-flex;
  flex: 0 0 29px;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(216, 132, 16, .18);
  border-radius: 9px;
  background: rgba(216, 132, 16, .09);
  color: #b16a08;
}

.dashboard-theme .configuration-report-type-icon .ui-icon {
  width: 15px;
  height: 15px;
}

.dashboard-theme .configuration-report-status {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: .55rem;
  font-weight: 850;
}

.dashboard-theme .configuration-report-status.is-active {
  background: rgba(17, 24, 28, .08);
  color: #26332f;
}

.dashboard-theme .configuration-report-status.is-inactive {
  background: rgba(112, 118, 132, .09);
  color: #777f82;
}

.dashboard-theme .configuration-report-actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}

.dashboard-theme .configuration-report-actions-cell form {
  display: inline-flex;
  margin: 0;
}

.dashboard-theme .configuration-report-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(17, 24, 28, .11);
  border-radius: 8px;
  background: #fff;
  color: #3c474b;
  box-shadow: 0 1px 1px rgba(17, 24, 28, .025);
  cursor: pointer;
  font: inherit;
  font-size: .55rem;
  font-weight: 800;
  line-height: 1;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}

.dashboard-theme .configuration-report-action-button .ui-icon {
  width: 13px;
  height: 13px;
}

.dashboard-theme .configuration-report-action-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.dashboard-theme .configuration-report-action-button.is-edit:hover:not(:disabled) {
  border-color: rgba(17, 24, 28, .24);
  background: rgba(17, 24, 28, .055);
  color: #172024;
}

.dashboard-theme .configuration-report-action-button.is-send {
  border-color: rgba(216, 132, 16, .24);
  background: rgba(216, 132, 16, .075);
  color: #9f5d06;
}

.dashboard-theme .configuration-report-action-button.is-send:hover:not(:disabled) {
  border-color: rgba(216, 132, 16, .42);
  background: rgba(216, 132, 16, .14);
  color: #814900;
}

.dashboard-theme .configuration-report-action-button.is-enable {
  border-color: rgba(31, 122, 87, .22);
  background: rgba(31, 122, 87, .07);
  color: #21694f;
}

.dashboard-theme .configuration-report-action-button.is-enable:hover:not(:disabled) {
  border-color: rgba(31, 122, 87, .36);
  background: rgba(31, 122, 87, .12);
}

.dashboard-theme .configuration-report-action-button.is-disable {
  border-color: rgba(99, 108, 112, .18);
  background: rgba(99, 108, 112, .055);
  color: #646d70;
}

.dashboard-theme .configuration-report-action-button.is-disable:hover:not(:disabled) {
  border-color: rgba(99, 108, 112, .3);
  background: rgba(99, 108, 112, .1);
  color: #465054;
}

.dashboard-theme .configuration-report-action-button:disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
}

.dashboard-theme .configuration-report-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 4px;
}

.dashboard-theme .configuration-report-empty > div {
  display: grid;
  gap: 2px;
}

.dashboard-theme .configuration-report-empty strong,
.dashboard-theme .configuration-report-empty span {
  display: block;
}

.dashboard-theme .configuration-report-empty-create {
  flex: 0 0 auto;
  min-height: 32px;
}

.dashboard-theme .configuration-report-table tbody tr.is-editing td {
  background: rgba(216, 132, 16, .055);
}

.dashboard-theme .configuration-report-table tbody tr.is-editing td:first-child {
  box-shadow: inset 3px 0 0 rgba(216, 132, 16, .75);
}

@media (max-width: 1300px) {
  .dashboard-theme .configuration-report-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-theme .configuration-user-fields,
  .dashboard-theme .configuration-report-form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .configuration-report-form-footer,
  .dashboard-theme .configuration-report-warning,
  .dashboard-theme .configuration-report-empty {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-theme .configuration-report-list-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-theme .configuration-report-list-tools,
  .dashboard-theme .configuration-report-form-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .dashboard-theme .configuration-report-new-button,
  .dashboard-theme .configuration-report-empty-create {
    width: 100%;
  }
}

/* Reportes: programación por múltiples módulos */
.dashboard-theme .configuration-report-schedule-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-theme .configuration-report-module-selector {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(17, 24, 28, .08);
  border-radius: 13px;
  background: rgba(255, 255, 255, .45);
}

.dashboard-theme .configuration-report-modules-header {
  margin-bottom: 9px;
}

.dashboard-theme .configuration-report-module-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.dashboard-theme .configuration-report-module-chip {
  position: relative;
  min-height: 62px;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 11px;
}

.dashboard-theme .configuration-report-module-chip > input {
  flex: 0 0 auto;
  margin-top: 3px;
}

.dashboard-theme .configuration-report-module-chip > .ui-icon {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  color: #b16a08;
}

.dashboard-theme .configuration-report-module-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.dashboard-theme .configuration-report-module-copy strong {
  color: #263034;
  font-size: .65rem;
  line-height: 1.2;
}

.dashboard-theme .configuration-report-module-copy small {
  display: -webkit-box;
  overflow: hidden;
  color: #747d80;
  font-size: .52rem;
  font-weight: 560;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dashboard-theme .configuration-report-module-chip:has(input:checked) {
  border-color: rgba(216, 132, 16, .38);
  background: rgba(216, 132, 16, .09);
  box-shadow: inset 0 0 0 1px rgba(216, 132, 16, .08);
}

.dashboard-theme .configuration-report-module-chip.is-unavailable {
  opacity: .48;
  background: rgba(17, 24, 28, .025);
}

.dashboard-theme .configuration-report-module-chip.is-unavailable .configuration-report-module-lock {
  display: inline-flex;
}

.dashboard-theme .configuration-report-module-lock {
  display: none;
  position: absolute;
  top: 7px;
  right: 8px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(17, 24, 28, .07);
  color: #687174;
  font-size: .46rem;
  font-weight: 850;
  text-transform: uppercase;
}

.dashboard-theme .configuration-report-type-bundle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-theme .configuration-report-type-icons {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}

.dashboard-theme .configuration-report-type-icons .configuration-report-type-icon {
  margin-left: -5px;
  border: 2px solid #fff;
}

.dashboard-theme .configuration-report-type-icons .configuration-report-type-icon:first-child {
  margin-left: 0;
}

.dashboard-theme .configuration-report-type-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.dashboard-theme .configuration-report-type-copy > strong {
  color: #263034;
  font-size: .61rem;
  font-weight: 800;
  line-height: 1.22;
}

.dashboard-theme .configuration-report-type-copy > small {
  color: #7a8386;
  font-size: .5rem;
}

@media (max-width: 1300px) {
  .dashboard-theme .configuration-report-schedule-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-theme .configuration-report-module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-theme .configuration-report-module-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================================== */
/* Sales orders — compact KPIs + order portfolio                              */
/* ========================================================================== */

.dashboard-theme .sales-fixed-kpis {
  gap: 8px;
}

.dashboard-theme .sales-fixed-kpis .sales-overview-kpi {
  min-height: 82px;
  padding: 10px 13px 11px;
  border-radius: 15px;
}

.dashboard-theme .sales-fixed-kpis .sales-overview-kpi > span,
.dashboard-theme .sales-fixed-kpis .sales-overview-kpi > small {
  font-size: .55rem;
}

.dashboard-theme .sales-fixed-kpis .sales-overview-kpi > strong {
  margin: 7px 0 5px;
  font-size: clamp(1.28rem, 1.75vw, 1.62rem);
}

.dashboard-theme .sales-fixed-kpis .sales-overview-progress {
  height: 4px;
  margin-bottom: 5px;
}

.dashboard-theme .sales-order-portfolio-card {
  position: relative;
  min-width: 0;
  margin: 10px 0 0;
  padding: 14px 16px 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: none;
}

.dashboard-theme .sales-order-portfolio-heading {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  margin: 0 0 9px;
}

.dashboard-theme .sales-order-portfolio-heading > div:first-child {
  min-width: 0;
}

.dashboard-theme .sales-order-portfolio-heading h2 {
  margin: 3px 0 0;
  font-size: 1.08rem;
  line-height: 1.08;
}

.dashboard-theme .sales-order-portfolio-heading p {
  max-width: 760px;
  margin: 4px 0 0;
  color: #737a76;
  font-size: .59rem;
  line-height: 1.35;
}

.dashboard-theme .sales-order-portfolio-card .widget-control-group {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
}

.dashboard-theme .sales-order-portfolio-count {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 26px;
  margin-right: 84px;
  padding: 5px 9px;
  border: 1px solid #e5d4b8;
  border-radius: 999px;
  color: #76501d;
  background: #fff7e8;
  font-size: .58rem;
  font-weight: 900;
  white-space: nowrap;
}

.dashboard-theme .sales-order-portfolio-toolbar {
  display: grid;
  grid-template-columns: minmax(190px, 230px) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin: 0 0 9px;
  padding: 8px 9px;
  border: 1px solid #e4ded4;
  border-radius: 14px;
  background: #f8f5ee;
}

.dashboard-theme .sales-order-portfolio-status-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-theme .sales-order-portfolio-status-field > span {
  padding-left: 2px;
  color: #777d79;
  font-size: .52rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dashboard-theme .sales-order-portfolio-status-field select,
.dashboard-theme .sales-order-portfolio-search-field input {
  width: 100%;
  min-height: 34px;
  border: 1px solid #d9d2c8;
  border-radius: 10px;
  color: #18201f;
  background: #fffdf9;
  font: inherit;
  font-size: .66rem;
  font-weight: 750;
  outline: none;
}

.dashboard-theme .sales-order-portfolio-status-field select {
  padding: 0 30px 0 10px;
}

.dashboard-theme .sales-order-portfolio-status-field select:focus,
.dashboard-theme .sales-order-portfolio-search-field input:focus {
  border-color: rgba(245, 159, 47, .7);
  box-shadow: 0 0 0 3px rgba(245, 159, 47, .10);
}

.dashboard-theme .sales-order-portfolio-search-field {
  position: relative;
  display: block;
  min-width: 0;
}

.dashboard-theme .sales-order-portfolio-search-field > .ui-icon {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 14px;
  height: 14px;
  color: #7b817d;
  transform: translateY(-50%);
  pointer-events: none;
}

.dashboard-theme .sales-order-portfolio-search-field input {
  padding: 0 12px 0 32px;
}

.dashboard-theme .sales-order-portfolio-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #11181c;
  border-radius: 10px;
  color: #fff;
  background: #11181c;
  font-size: .62rem;
  font-weight: 900;
  cursor: pointer;
}

.dashboard-theme .sales-order-portfolio-refresh:hover {
  border-color: #f59f2f;
  background: #202a2f;
}

.dashboard-theme .sales-order-portfolio-refresh:disabled {
  cursor: wait;
  opacity: .58;
}

.dashboard-theme .sales-order-portfolio-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 112px;
  color: #737a76;
  font-size: .65rem;
  font-weight: 750;
}

.dashboard-theme .sales-order-portfolio-state[data-state="error"] {
  color: #9e3c2b;
}

.dashboard-theme .sales-order-portfolio-state[data-state="empty"] .sales-order-portfolio-loader,
.dashboard-theme .sales-order-portfolio-state[data-state="error"] .sales-order-portfolio-loader {
  display: none;
}

.dashboard-theme .sales-order-portfolio-loader {
  width: 14px;
  height: 14px;
  border: 2px solid #e1d7c7;
  border-top-color: #f59f2f;
  border-radius: 50%;
  animation: sales-order-portfolio-spin .7s linear infinite;
}

@keyframes sales-order-portfolio-spin {
  to { transform: rotate(360deg); }
}

/* ========================================================================== */
/* Tesorería — Detail of value movements                                      */
/* ========================================================================== */
.dashboard-theme .treasury-movement-shell { min-width: 0; }
.dashboard-theme .treasury-movement-card { margin: 6px 0 0; padding: 12px 14px 10px; border: 1px solid #d9e1dc; border-radius: 20px; background: linear-gradient(145deg, #fffdf8, #f6faf7); }
.dashboard-theme .treasury-movement-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 7px; }
.dashboard-theme .treasury-movement-heading-copy { min-width: 0; }
.dashboard-theme .treasury-movement-heading h2 { margin: 0; font-size: 1.08rem; line-height: 1.1; }
.dashboard-theme .treasury-movement-heading p { margin: 3px 0 0; color: #69736e; font-size: .61rem; line-height: 1.3; }
.dashboard-theme .treasury-movement-count { align-self: flex-start; padding: 5px 10px; border-radius: 999px; color: #255f54; background: #e7f4ed; font-size: .58rem; font-weight: 900; white-space: nowrap; }

.dashboard-theme .treasury-movement-print-button {
  width: auto;
  min-width: 88px;
  padding: 0 11px;
  gap: 6px;
  font-size: .58rem;
  font-weight: 900;
  white-space: nowrap;
}
.dashboard-theme .treasury-movement-print-button::before {
  width: calc(100% + 12px);
}
.dashboard-theme .treasury-movement-print-button svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}
.dashboard-theme .treasury-movement-toolbar { display: grid; grid-template-columns: minmax(320px, 1.45fr) minmax(150px, .78fr) minmax(126px, .64fr) minmax(126px, .64fr) minmax(150px, .75fr); gap: 8px; align-items: start; margin-top: 0; padding: 8px; border: 1px solid #dfe6df; border-radius: 14px; background: #edf4f0; }
.dashboard-theme .treasury-movement-field { display: grid; gap: 3px; min-width: 0; }
.dashboard-theme .treasury-movement-field > span { min-height: 11px; padding-left: 2px; color: #64716a; font-size: .5rem; font-weight: 900; line-height: 11px; letter-spacing: .05em; text-transform: uppercase; }
.dashboard-theme .treasury-movement-field select, .dashboard-theme .treasury-movement-field input { min-width: 0; min-height: 34px; padding: 0 9px; border: 1px solid #cad7cf; border-radius: 9px; color: #17231f; background: #fffefa; font: inherit; font-size: .66rem; font-weight: 750; }
.dashboard-theme .treasury-movement-field select:focus, .dashboard-theme .treasury-movement-field input:focus { border-color: #2f8c75; outline: 0; box-shadow: 0 0 0 3px rgba(47, 140, 117, .12); }
.dashboard-theme .treasury-movement-value-picker { position: relative; align-self: start; gap: 5px; }
.dashboard-theme .treasury-movement-value-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.dashboard-theme .treasury-movement-value-controls button { min-height: 34px; padding: 0 10px; border: 1px solid #b9d0c2; border-radius: 9px; color: #1f5545; background: #f7fcf8; font: inherit; font-size: .6rem; font-weight: 900; cursor: pointer; }
.dashboard-theme .treasury-movement-value-controls button:hover:not(:disabled) { border-color: #2f8c75; background: #e4f3e9; }
.dashboard-theme .treasury-movement-value-controls button:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(47, 140, 117, .18); }
.dashboard-theme .treasury-movement-value-controls button:disabled { cursor: default; opacity: .56; }
.dashboard-theme .treasury-movement-search-field input { padding-right: 28px; }

.dashboard-theme .treasury-movement-analysis { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 8px 0; }
.dashboard-theme .treasury-movement-analysis[hidden] { display: none; }
.dashboard-theme .treasury-movement-analysis-panel { min-width: 0; overflow: hidden; border: 1px solid #dce6df; border-radius: 12px; background: #fffefa; }
.dashboard-theme .treasury-movement-analysis-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-height: 38px; padding: 7px 9px 6px; border-bottom: 1px solid #e4ebe6; background: #f8fbf9; }
.dashboard-theme .treasury-movement-analysis-heading > div { min-width: 0; }
.dashboard-theme .treasury-movement-analysis-heading h3 { margin: 0; overflow: hidden; color: #203f36; font-size: .69rem; font-weight: 950; line-height: 1.18; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-theme .treasury-movement-analysis-heading p { margin: 2px 0 0; color: #748078; font-size: .5rem; line-height: 1.2; }
.dashboard-theme .treasury-movement-analysis-heading-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.dashboard-theme .treasury-movement-analysis-heading-actions > span { padding: 3px 6px; border-radius: 999px; color: #315f52; background: #e8f3ed; font-size: .49rem; font-weight: 900; white-space: nowrap; }
.dashboard-theme .treasury-movement-analysis-heading-actions > button { min-height: 20px; padding: 2px 7px; border: 1px solid #c7ddd0; border-radius: 999px; color: #315f52; background: #fffefa; font: inherit; font-size: .49rem; font-weight: 900; cursor: pointer; }
.dashboard-theme .treasury-movement-analysis-heading-actions > button:hover { border-color: #2f8c75; background: #edf7f0; }
.dashboard-theme .treasury-movement-analysis-heading-actions > button:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(47, 140, 117, .18); }
.dashboard-theme .treasury-movement-analysis-heading-actions > button[hidden] { display: none; }
.dashboard-theme .treasury-movement-analysis-table-wrap { max-height: 156px; overflow: auto; background: #fffefa; scrollbar-width: thin; }
.dashboard-theme .treasury-movement-analysis-table { width: 100%; min-width: 560px; border-collapse: separate; border-spacing: 0; font-size: .56rem; }
.dashboard-theme .treasury-movement-analysis-table th { position: sticky; z-index: 2; top: 0; padding: 5px 7px; color: #fff; background: #19463b; font-size: .48rem; font-weight: 900; letter-spacing: .035em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.dashboard-theme .treasury-movement-analysis-table td { padding: 5px 7px; border-bottom: 1px solid #edf0ed; color: #3d4b45; vertical-align: middle; background: #fffefa; }
.dashboard-theme .treasury-movement-analysis-table tbody tr:last-child td { border-bottom: 0; }
.dashboard-theme .treasury-movement-analysis-table td > strong, .dashboard-theme .treasury-movement-analysis-table td > small { display: block; }
.dashboard-theme .treasury-movement-analysis-table td > strong { color: #2a453c; font-size: .57rem; font-weight: 900; }
.dashboard-theme .treasury-movement-analysis-table td > small { margin-top: 1px; color: #7a8881; font-size: .47rem; line-height: 1.15; }
.dashboard-theme .treasury-movement-analysis-table .number-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashboard-theme .treasury-movement-analysis-row { cursor: pointer; }
.dashboard-theme .treasury-movement-analysis-row:hover td { background: #f1f8f4; }
.dashboard-theme .treasury-movement-analysis-row:focus { outline: 0; }
.dashboard-theme .treasury-movement-analysis-row:focus-visible td { box-shadow: inset 0 0 0 2px rgba(47, 140, 117, .24); }
.dashboard-theme .treasury-movement-analysis-row.is-selected td { background: #e4f2ea; }
.dashboard-theme .treasury-movement-analysis-row.is-selected td:first-child { box-shadow: inset 3px 0 0 #2f8c75; }
.dashboard-theme .treasury-movement-analysis-total-row td { background: #f4f8f5; font-weight: 900; }
.dashboard-theme .treasury-movement-analysis-total-row.is-selected td { background: #dceee4; }
.dashboard-theme .treasury-movement-summary-inflow { color: #247051 !important; }
.dashboard-theme .treasury-movement-summary-outflow { color: #9b493f !important; }
.dashboard-theme .treasury-movement-summary-net { color: #173f35 !important; font-weight: 950; }
.dashboard-theme .treasury-movement-analysis-actions { width: 30px; min-width: 30px; text-align: center !important; }
.dashboard-theme .treasury-movement-analysis-actions button { display: inline-grid; width: 19px; height: 19px; place-items: center; padding: 0; border: 1px solid #c7ddd0; border-radius: 50%; color: #37695a; background: #edf7f0; font: inherit; font-size: .72rem; font-weight: 900; line-height: 1; cursor: pointer; }
.dashboard-theme .treasury-movement-analysis-actions button:hover { border-color: #b75d50; color: #fff; background: #b75d50; }
.dashboard-theme .treasury-movement-analysis-actions button:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(47, 140, 117, .18); }

.dashboard-theme .treasury-movement-detail-context { display: flex; align-items: center; min-height: 29px; margin: 0 0 5px; padding: 5px 8px; border: 1px solid #e0e8e3; border-radius: 9px; background: #f8fbf9; }
.dashboard-theme .treasury-movement-detail-context[hidden] { display: none; }
.dashboard-theme .treasury-movement-detail-context span { min-width: 0; }
.dashboard-theme .treasury-movement-detail-context small { display: inline; margin-right: 7px; color: #718078; font-size: .48rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.dashboard-theme .treasury-movement-detail-context strong { color: #24483e; font-size: .59rem; font-weight: 900; }
.dashboard-theme .treasury-movement-state { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 76px; color: #68746d; font-size: .67rem; font-weight: 750; }
.dashboard-theme .treasury-movement-state[data-state="error"] { color: #a13e34; }
.dashboard-theme .treasury-movement-state[data-state="empty"] .treasury-movement-loader,
.dashboard-theme .treasury-movement-state[data-state="error"] .treasury-movement-loader { display: none; }
.dashboard-theme .treasury-movement-loader { width: 14px; height: 14px; border: 2px solid #d3dfd7; border-top-color: #2f8c75; border-radius: 50%; animation: treasury-movement-spin .7s linear infinite; }
@keyframes treasury-movement-spin { to { transform: rotate(360deg); } }
.dashboard-theme .treasury-movement-table-wrap { height: clamp(300px, calc(100vh - 525px), 650px); overflow: auto; border: 1px solid #dfe7e1; border-radius: 12px; background: #fffefa; }
.dashboard-theme .treasury-movement-table { width: 100%; min-width: 1260px; border-collapse: separate; border-spacing: 0; font-size: .61rem; }
.dashboard-theme .treasury-movement-table th { position: sticky; z-index: 2; top: 0; padding: 7px 8px; color: #fff; background: #153b33; font-size: .52rem; letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; }

.dashboard-theme .treasury-movement-sort { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; font-weight: 900; letter-spacing: inherit; text-transform: inherit; white-space: nowrap; cursor: pointer; }
.dashboard-theme .treasury-movement-sort > span { display: inline-block; min-width: 9px; font-size: .62rem; line-height: 1; opacity: .72; }
.dashboard-theme .treasury-movement-sort:hover, .dashboard-theme .treasury-movement-sort:focus-visible, .dashboard-theme .treasury-movement-sort.is-active { color: #fff; }
.dashboard-theme .treasury-movement-sort:hover > span, .dashboard-theme .treasury-movement-sort:focus-visible > span, .dashboard-theme .treasury-movement-sort.is-active > span { opacity: 1; }
.dashboard-theme .treasury-movement-sort:focus-visible { border-radius: 3px; outline: 2px solid rgba(255,255,255,.9); outline-offset: 2px; }
.dashboard-theme .treasury-movement-sort-number { display: flex; width: max-content; margin-left: auto; }
.dashboard-theme .treasury-movement-table td { padding: 6px 8px; border-bottom: 1px solid #edf0ed; color: #3d4b45; vertical-align: middle; }
.dashboard-theme .treasury-movement-table tbody tr:hover:not(.treasury-movement-detail-row) td { background: #f2f9f4; }
.dashboard-theme .treasury-movement-table td > strong, .dashboard-theme .treasury-movement-table td > small { display: block; }
.dashboard-theme .treasury-movement-table td > small { margin-top: 2px; color: #7c8982; font-size: .51rem; }
.dashboard-theme .treasury-movement-month-cell { min-width: 108px; color: #255f54; font-weight: 900; white-space: nowrap; }
.dashboard-theme .treasury-movement-month-start td { border-top: 2px solid #cfe2d7; }
.dashboard-theme .treasury-movement-month-start:first-child td { border-top: 0; }
.dashboard-theme .treasury-movement-payment-order-cell, .dashboard-theme .treasury-movement-receipt-cell, .dashboard-theme .treasury-movement-reference-cell { min-width: 76px; white-space: nowrap; }
.dashboard-theme .treasury-movement-payment-order, .dashboard-theme .treasury-movement-receipt, .dashboard-theme .treasury-movement-reference { padding: 0; border: 0; color: #255f54; background: transparent; font: inherit; font-weight: 900; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer; }
.dashboard-theme .treasury-movement-payment-order:hover, .dashboard-theme .treasury-movement-receipt:hover, .dashboard-theme .treasury-movement-reference:hover { color: #153b33; }
.dashboard-theme .treasury-movement-payment-order:focus-visible, .dashboard-theme .treasury-movement-receipt:focus-visible, .dashboard-theme .treasury-movement-reference:focus-visible { border-radius: 3px; outline: 0; box-shadow: 0 0 0 3px rgba(47, 140, 117, .18); }
.dashboard-theme .treasury-movement-table .number-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashboard-theme .treasury-movement-inflow { color: #247051; }
.dashboard-theme .treasury-movement-outflow { color: #a34b3d; }
.dashboard-theme .treasury-movement-net, .dashboard-theme .treasury-movement-balance { color: #204b40; font-weight: 900; }
.dashboard-theme .treasury-movement-expand { width: 23px; height: 23px; border: 1px solid #cce0d4; border-radius: 7px; color: #28614f; background: #f0f8f2; font: inherit; font-weight: 900; cursor: pointer; }
.dashboard-theme .treasury-movement-expand:hover, .dashboard-theme .treasury-movement-expand:focus-visible { border-color: #2f8c75; outline: 0; }
.dashboard-theme .treasury-movement-detail-row td { padding: 0; background: #f4f8f5; }
.dashboard-theme .treasury-movement-detail { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 8px 12px; }
.dashboard-theme .treasury-movement-detail span { min-width: 0; }
.dashboard-theme .treasury-movement-detail small, .dashboard-theme .treasury-movement-detail strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-theme .treasury-movement-detail small { color: #718078; font-size: .49rem; font-weight: 900; text-transform: uppercase; }
.dashboard-theme .treasury-movement-detail strong { margin-top: 2px; color: #394941; font-size: .58rem; }
.dashboard-theme .treasury-movement-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 7px; color: #69766f; font-size: .57rem; font-weight: 750; }
.dashboard-theme .treasury-movement-pager { display: inline-flex; align-items: center; gap: 7px; }
.dashboard-theme .treasury-movement-pager button { width: 29px; height: 27px; border: 1px solid #cad8d0; border-radius: 8px; color: #214239; background: #fffefa; font-size: 1rem; cursor: pointer; }
.dashboard-theme .treasury-movement-pager button:disabled { cursor: default; opacity: .35; }

.dashboard-theme .treasury-payment-order-modal-card { width: min(1180px, calc(100vw - 28px)); max-height: calc(100vh - 20px); overflow: auto; padding: 14px 16px; }
.dashboard-theme .treasury-payment-order-modal-heading { margin-bottom: 7px; }
.dashboard-theme .treasury-payment-order-modal-heading .eyebrow { margin-bottom: 2px; }
.dashboard-theme .treasury-payment-order-modal-heading h2 { font-size: 1.28rem; line-height: 1.08; }
.dashboard-theme .treasury-payment-order-modal-heading p { margin-top: 3px; font-size: .72rem; line-height: 1.25; }
.dashboard-theme .treasury-payment-order-state { display: grid; min-height: 90px; place-items: center; padding: 14px; border: 1px dashed #cfdbd3; border-radius: 12px; color: #65736c; background: #f7faf8; font-size: .7rem; font-weight: 800; text-align: center; }
.dashboard-theme .treasury-payment-order-state[data-state="loading"]::before { content: ''; width: 18px; height: 18px; margin-bottom: 6px; border: 2px solid #d3dfd7; border-top-color: #2f8c75; border-radius: 50%; animation: treasury-movement-spin .7s linear infinite; }
.dashboard-theme .treasury-payment-order-state[data-state="error"] { border-color: #e3c1bb; color: #9a4035; background: #fff7f5; }
.dashboard-theme .treasury-payment-order-content { display: grid; gap: 7px; }
.dashboard-theme .treasury-payment-order-summary { display: grid; grid-template-columns: .7fr .75fr .8fr 1.75fr; gap: 6px; }
.dashboard-theme .treasury-payment-order-summary > span { min-width: 0; padding: 7px 9px; border: 1px solid #dfe8e2; border-radius: 10px; background: #f8fbf9; }
.dashboard-theme .treasury-payment-order-summary small, .dashboard-theme .treasury-payment-order-summary strong { display: block; }
.dashboard-theme .treasury-payment-order-summary small { color: #718078; font-size: .49rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.dashboard-theme .treasury-payment-order-summary strong { margin-top: 2px; overflow: hidden; color: #203f36; font-size: .69rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-theme .treasury-payment-order-summary-supplier { min-width: 220px; }
.dashboard-theme .treasury-payment-order-summary-wide { grid-column: 1 / -1; }
.dashboard-theme .treasury-payment-order-summary-wide strong { white-space: normal; }
.dashboard-theme .treasury-payment-order-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.dashboard-theme .treasury-receipt-totals { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dashboard-theme .treasury-payment-order-totals > span { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 6px 9px; border: 1px solid #dfe8e2; border-radius: 10px; background: #f8fbf9; }
.dashboard-theme .treasury-payment-order-totals small { color: #718078; font-size: .49rem; font-weight: 900; letter-spacing: .035em; text-transform: uppercase; }
.dashboard-theme .treasury-payment-order-totals strong { color: #203f36; font-size: .72rem; font-weight: 950; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashboard-theme .treasury-payment-order-section { padding: 8px 10px 9px; border: 1px solid #dfe7e2; border-radius: 12px; background: #fffefa; }
.dashboard-theme .treasury-payment-order-section-heading { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 5px; }
.dashboard-theme .treasury-payment-order-section-heading h3 { margin: 0; color: #213e36; font-size: .78rem; font-weight: 950; line-height: 1.15; }
.dashboard-theme .treasury-payment-order-section-heading p { margin: 1px 0 0; color: #758078; font-size: .54rem; line-height: 1.2; }
.dashboard-theme .treasury-payment-order-section-heading > span { padding: 3px 6px; border-radius: 999px; color: #315f52; background: #eaf4ee; font-size: .5rem; font-weight: 900; white-space: nowrap; }
.dashboard-theme .treasury-payment-order-table-wrap { max-height: 190px; overflow: auto; border: 1px solid #e1e7e3; border-radius: 9px; }
.dashboard-theme [data-treasury-payment-order-concepts-wrap] { max-height: 145px; }
.dashboard-theme [data-treasury-payment-order-values-wrap] { max-height: none; overflow-x: auto; overflow-y: visible; }
.dashboard-theme .treasury-payment-order-table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; font-size: .6rem; }
.dashboard-theme .treasury-payment-order-values-table { min-width: 980px; }
.dashboard-theme .treasury-receipt-values-table { min-width: 820px; }
.dashboard-theme .treasury-payment-order-table th { position: sticky; z-index: 1; top: 0; padding: 5px 7px; color: #fff; background: #173f36; font-size: .49rem; font-weight: 900; letter-spacing: .03em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.dashboard-theme .treasury-payment-order-table td { padding: 5px 7px; border-bottom: 1px solid #edf0ee; color: #3d4b45; vertical-align: middle; }
.dashboard-theme .treasury-payment-order-table tbody tr:last-child td { border-bottom: 0; }
.dashboard-theme .treasury-payment-order-table td > strong, .dashboard-theme .treasury-payment-order-table td > small { display: block; }
.dashboard-theme .treasury-payment-order-table td > strong { color: #2a453c; font-weight: 900; }
.dashboard-theme .treasury-payment-order-table td > small { margin-top: 1px; color: #7a8881; font-size: .49rem; line-height: 1.15; }
.dashboard-theme .treasury-payment-order-table .number-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashboard-theme .treasury-payment-order-empty { margin: 0; padding: 12px; border: 1px dashed #d8e1db; border-radius: 9px; color: #738078; background: #f8faf8; font-size: .6rem; font-weight: 750; text-align: center; }
.dashboard-theme .treasury-value-movement-modal-card { width: min(1040px, calc(100vw - 28px)); }
.dashboard-theme .treasury-value-movement-summary { grid-template-columns: .62fr .76fr 1.25fr 1fr; }
.dashboard-theme .treasury-value-movement-description, .dashboard-theme .treasury-value-movement-observation { grid-column: span 2; }
.dashboard-theme .treasury-value-movement-table { min-width: 780px; }
.dashboard-theme [data-treasury-value-movement-entries-wrap], .dashboard-theme [data-treasury-value-movement-exits-wrap] { max-height: 240px; }
@media (max-width: 1120px) {
  .dashboard-theme .treasury-movement-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-theme .treasury-movement-value-picker { grid-column: 1 / span 2; }
  .dashboard-theme .treasury-movement-analysis { grid-template-columns: 1fr; }
  .dashboard-theme .treasury-movement-analysis-table-wrap { max-height: 145px; }
}
@media (max-width: 960px) {
  .dashboard-theme .treasury-payment-order-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-theme .treasury-payment-order-summary-supplier { min-width: 0; }
  .dashboard-theme .treasury-payment-order-summary-wide { grid-column: 1 / -1; }
  .dashboard-theme .treasury-payment-order-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-theme .treasury-receipt-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-theme .treasury-movement-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-theme .treasury-movement-value-picker { grid-column: 1 / -1; }
  .dashboard-theme .treasury-movement-analysis { grid-template-columns: 1fr; }
  .dashboard-theme .treasury-movement-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-theme .treasury-movement-table-wrap { height: clamp(300px, 45vh, 560px); }
}
@media (max-width: 620px) {
  .dashboard-theme .treasury-payment-order-summary { grid-template-columns: 1fr; }
  .dashboard-theme .treasury-payment-order-summary-wide { grid-column: auto; }
  .dashboard-theme .treasury-payment-order-totals { grid-template-columns: 1fr; }
  .dashboard-theme .treasury-payment-order-section-heading { flex-direction: column; }
  .dashboard-theme .treasury-movement-heading,
  .dashboard-theme .treasury-movement-footer { align-items: flex-start; flex-direction: column; }
  .dashboard-theme .treasury-movement-toolbar { grid-template-columns: 1fr; }
  .dashboard-theme .treasury-movement-analysis { grid-template-columns: 1fr; }
  .dashboard-theme .treasury-movement-value-picker { grid-column: auto; }
  .dashboard-theme .treasury-movement-detail { grid-template-columns: 1fr; }
  .dashboard-theme .treasury-movement-table-wrap { height: clamp(300px, 52vh, 520px); }
}
@media (prefers-reduced-motion: reduce) { .dashboard-theme .treasury-movement-loader { animation: none; } }


@media (max-width: 760px) {
  .dashboard-theme .treasury-value-movement-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-theme .treasury-value-movement-description, .dashboard-theme .treasury-value-movement-observation { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .dashboard-theme .treasury-value-movement-summary { grid-template-columns: 1fr; }
  .dashboard-theme .treasury-value-movement-description, .dashboard-theme .treasury-value-movement-observation { grid-column: auto; }
}

.dashboard-theme .sales-order-portfolio-table-wrap {
  max-height: 325px;
  overflow: auto;
  border: 1px solid #e4ded4;
  border-radius: 12px;
  background: #fffdf9;
}

.dashboard-theme .sales-order-portfolio-table {
  width: 100%;
  min-width: 1030px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .61rem;
}

.dashboard-theme .sales-order-portfolio-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 8px 9px;
  border-bottom: 1px solid #30383b;
  color: #fff;
  background: #11181c;
  font-size: .54rem;
  font-weight: 900;
  letter-spacing: .025em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.dashboard-theme .sales-order-portfolio-table tbody td {
  padding: 7px 9px;
  border-bottom: 1px solid #eee8de;
  color: #3c4541;
  vertical-align: middle;
}

.dashboard-theme .sales-order-portfolio-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-theme .sales-order-portfolio-table tbody tr:hover td {
  background: #fff8eb;
}

.dashboard-theme .sales-order-portfolio-table td > strong,
.dashboard-theme .sales-order-portfolio-table td > small {
  display: block;
}

.dashboard-theme .sales-order-portfolio-table td > strong {
  color: #1b2422;
  font-size: .63rem;
  font-weight: 850;
}

.dashboard-theme .sales-order-portfolio-table td > small {
  margin-top: 2px;
  color: #89908c;
  font-size: .51rem;
}

.dashboard-theme .sales-order-portfolio-order {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #ead7b8;
  border-radius: 9px;
  color: #8a5919;
  background: #fff8ea;
  font: inherit;
  font-size: .61rem;
  font-weight: 950;
  cursor: pointer;
}

.dashboard-theme .sales-order-portfolio-order:hover,
.dashboard-theme .sales-order-portfolio-order:focus-visible {
  border-color: #f59f2f;
  color: #11181c;
  background: #fff1d4;
}

.dashboard-theme .sales-order-portfolio-order .ui-icon {
  width: 13px;
  height: 13px;
}

.dashboard-theme .sales-order-portfolio-purchase-order,
.dashboard-theme .sales-order-portfolio-date {
  white-space: nowrap;
}

.dashboard-theme .sales-order-portfolio-status {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: .53rem;
  font-weight: 900;
  white-space: nowrap;
}

.dashboard-theme .sales-order-portfolio-status.is-pending-preparation {
  color: #95541a;
  background: #fff0d8;
}

.dashboard-theme .sales-order-portfolio-status.is-pending-remittance {
  color: #245e78;
  background: #eaf5fb;
}

.dashboard-theme .sales-order-portfolio-status.is-pending-invoicing {
  color: #8a5a14;
  background: #fff3d8;
}

.dashboard-theme .sales-order-portfolio-status.is-clear {
  color: #40705c;
  background: #eaf4ef;
}

.dashboard-theme .sales-order-portfolio-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 7px 2px 0;
  color: #777e79;
  font-size: .56rem;
  font-weight: 750;
}

.dashboard-theme .sales-order-portfolio-pager {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dashboard-theme .sales-order-portfolio-pager button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 27px;
  padding: 0;
  border: 1px solid #dcd4c9;
  border-radius: 8px;
  color: #202927;
  background: #fffdf9;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.dashboard-theme .sales-order-portfolio-pager button:hover:not(:disabled) {
  border-color: #f59f2f;
  background: #fff7e8;
}

.dashboard-theme .sales-order-portfolio-pager button:disabled {
  cursor: default;
  opacity: .35;
}

.dashboard-theme .widget-modal-backdrop > .sales-order-portfolio-card.is-widget-maximized .sales-order-portfolio-table-wrap {
  max-height: calc(100vh - 300px);
}

@media (min-width: 1181px) {
  .dashboard-theme #sales-panel-orders.is-active .sales-orders-grid {
    min-height: 315px;
    height: clamp(315px, 38dvh, 405px);
  }

  .dashboard-theme .content-wrap:has(.sales-tabbed-shell) .sales-tabbed-shell:has(#sales-panel-orders.is-active) {
    min-height: 0;
  }
}

@media (max-width: 900px) {
  .dashboard-theme .sales-order-portfolio-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .dashboard-theme .sales-order-portfolio-search-field {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .dashboard-theme .sales-order-portfolio-refresh {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 720px) {
  .dashboard-theme .sales-fixed-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .sales-order-portfolio-heading {
    display: block;
    padding-right: 72px;
  }

  .dashboard-theme .sales-order-portfolio-count {
    margin: 8px 0 0;
  }

  .dashboard-theme .sales-order-portfolio-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-theme .sales-order-portfolio-status-field,
  .dashboard-theme .sales-order-portfolio-search-field,
  .dashboard-theme .sales-order-portfolio-refresh {
    grid-column: 1;
    grid-row: auto;
  }

  .dashboard-theme .sales-order-portfolio-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-theme .sales-order-portfolio-loader {
    animation: none;
  }
}

/* ========================================================================== */
/* Sales — contextual help, order actions and order-status drill-down          */
/* ========================================================================== */

.dashboard-theme [data-widget-tab="ventas"].has-widget-controls > .card-heading,
.dashboard-theme [data-widget-tab="ventas"].has-widget-controls > .sales-order-portfolio-heading {
  padding-right: 112px;
}

.dashboard-theme [data-widget-tab="ventas"] .widget-control-group {
  gap: 8px;
}

.dashboard-theme .sales-widget-help {
  z-index: 9;
}

.dashboard-theme .sales-widget-help > summary {
  width: 28px;
  height: 28px;
  border-color: rgba(17, 24, 28, .18);
  background: #fffdf8;
  color: #4b5552;
  font-size: .70rem;
}

.dashboard-theme .sales-widget-help-popover {
  z-index: 40;
  width: min(330px, 78vw);
  text-align: left;
}

.dashboard-theme .sales-widget-help-popover strong {
  font-size: .70rem;
}

.dashboard-theme .sales-widget-help-popover p {
  font-size: .64rem;
  line-height: 1.48;
}

.dashboard-theme .sales-order-portfolio-card .sales-order-portfolio-count {
  margin-right: 118px;
}

.dashboard-theme .sales-order-portfolio-order {
  gap: 0;
  min-width: 56px;
  justify-content: center;
}

.dashboard-theme .sales-order-status-modal-card {
  display: flex;
  flex-direction: column;
  width: min(1120px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  padding: 18px;
}

.dashboard-theme .sales-order-status-modal-table th {
  min-height: 40px;
  padding: 9px 10px;
  color: #59625f;
  font-size: .62rem;
  font-weight: 950;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.dashboard-theme .sales-order-status-modal-table td:first-child {
  width: 110px;
}

.dashboard-theme .sales-order-status-chart-wrap canvas {
  cursor: pointer;
}

@media (max-width: 720px) {
  .dashboard-theme [data-widget-tab="ventas"].has-widget-controls > .card-heading,
  .dashboard-theme [data-widget-tab="ventas"].has-widget-controls > .sales-order-portfolio-heading {
    padding-right: 104px;
  }

  .dashboard-theme .sales-order-portfolio-card .sales-order-portfolio-count {
    margin-right: 0;
  }

  .dashboard-theme .sales-order-status-modal-card {
    width: min(100% - 18px, 1120px);
    max-height: calc(100vh - 18px);
    padding: 13px;
  }
}


/* Sales contextual help must be able to overlap neighboring cards. The sales
   cards intentionally clip charts and tables, so only relax overflow while
   their help popover is open. */
.dashboard-theme [data-widget-tab="ventas"].has-widget-controls:has(.sales-widget-help[open]) {
  z-index: 50;
  overflow: visible !important;
}

.dashboard-theme [data-widget-tab="ventas"].has-widget-controls:has(.sales-widget-help[open]) .widget-control-group,
.dashboard-theme [data-widget-tab="ventas"].has-widget-controls:has(.sales-widget-help[open]) .sales-widget-help {
  z-index: 60;
}


/* ========================================================================== */
/* Sales orders — page scroll for the extended orders workspace               */
/* ========================================================================== */

@media (min-width: 901px) and (min-height: 760px) {
  /* The rest of Ventas keeps its fixed desktop workspace. Pedidos is taller
     because it also contains the operational order portfolio. When Pedidos is
     active, release the viewport locks and let the document/body own vertical
     scrolling. This keeps all cards in the normal page flow instead of moving
     an inner widget workspace independently from the page. */
  body.dashboard-theme:has(#sales-panel-orders.is-active):not(.widget-maximized) {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .dashboard-theme .app-shell:has(#sales-panel-orders.is-active) {
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible !important;
  }

  .dashboard-theme .content-wrap:has(#sales-panel-orders.is-active) {
    height: auto !important;
    min-height: calc(100vh - 36px) !important;
    min-height: calc(100dvh - 36px) !important;
    overflow: visible !important;
  }

  .dashboard-theme .content-wrap:has(#sales-panel-orders.is-active)
    .sales-tabbed-shell:has(#sales-panel-orders.is-active) {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding-right: 0;
  }

  .dashboard-theme #sales-panel-orders.is-active {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding-bottom: 10px;
  }

  .dashboard-theme #sales-panel-orders.is-active .sales-orders-grid {
    height: clamp(300px, 36dvh, 390px) !important;
    min-height: 300px !important;
    grid-auto-rows: minmax(0, 1fr);
  }

  .dashboard-theme #sales-panel-orders.is-active .sales-order-portfolio-card {
    min-height: 250px;
    margin-bottom: 8px;
  }
}

/* ========================================================================== */
/* Operational modules — contextual widget help (Producción/Stock/Compras/    */
/* Entregas). The flyout lives under <body> so card/grid overflow can never   */
/* crop the explanation.                                                       */
/* ========================================================================== */

.dashboard-theme .dashboard-widget-help-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin: 0;
  border: 1px solid rgba(17, 24, 28, .18);
  border-radius: 999px;
  background: #fffdf8;
  color: #4b5552;
  font: inherit;
  font-size: .70rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.dashboard-theme .dashboard-widget-help-button:hover,
.dashboard-theme .dashboard-widget-help-button:focus-visible,
.dashboard-theme .dashboard-widget-help-button.is-open {
  border-color: rgba(216, 132, 16, .48);
  background: #fff4df;
  color: #9e5c08;
  outline: none;
  box-shadow: 0 7px 18px rgba(32, 38, 42, .10);
}

.dashboard-theme .dashboard-widget-help-button:hover {
  transform: translateY(-1px);
}

.dashboard-theme .dashboard-widget-help-button:focus-visible {
  outline: 3px solid rgba(216, 132, 16, .22);
  outline-offset: 2px;
}

.dashboard-theme .customer-account-chart-help > summary,
.dashboard-theme .supplier-purchase-payment-help > summary,
.dashboard-theme .sales-widget-help > summary {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(17, 24, 28, .18);
  background: #fffdf8;
  color: #4b5552;
  font-size: .70rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: none;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.dashboard-theme .customer-account-chart-help[open] > summary,
.dashboard-theme .customer-account-chart-help > summary:hover,
.dashboard-theme .customer-account-chart-help > summary:focus-visible,
.dashboard-theme .supplier-purchase-payment-help[open] > summary,
.dashboard-theme .supplier-purchase-payment-help > summary:hover,
.dashboard-theme .supplier-purchase-payment-help > summary:focus-visible,
.dashboard-theme .sales-widget-help[open] > summary,
.dashboard-theme .sales-widget-help > summary:hover,
.dashboard-theme .sales-widget-help > summary:focus-visible {
  border-color: rgba(216, 132, 16, .48);
  background: #fff4df;
  color: #9e5c08;
  outline: none;
  box-shadow: 0 7px 18px rgba(32, 38, 42, .10);
}

.dashboard-theme .customer-account-chart-help > summary:hover,
.dashboard-theme .supplier-purchase-payment-help > summary:hover,
.dashboard-theme .sales-widget-help > summary:hover {
  transform: translateY(-1px);
}

.dashboard-theme .customer-account-chart-help > summary:focus-visible,
.dashboard-theme .supplier-purchase-payment-help > summary:focus-visible,
.dashboard-theme .sales-widget-help > summary:focus-visible {
  outline: 3px solid rgba(216, 132, 16, .22);
  outline-offset: 2px;
}

.dashboard-theme .dashboard-widget-help-flyout {
  position: fixed;
  z-index: 2600;
  width: min(340px, calc(100vw - 24px));
  max-height: min(320px, calc(100vh - 24px));
  overflow: auto;
  padding: 11px 12px;
  border: 1px solid rgba(15, 24, 34, .13);
  border-radius: 12px;
  background: #fffdf8;
  box-shadow: 0 16px 38px rgba(20, 24, 28, .18);
  color: #53615e;
  text-align: left;
  scrollbar-width: thin;
}

.dashboard-theme .dashboard-widget-help-flyout[hidden] {
  display: none !important;
}

.dashboard-theme .dashboard-widget-help-title {
  display: block;
  margin-bottom: 5px;
  color: #15212a;
  font-size: .72rem;
  font-weight: 900;
  line-height: 1.25;
}

.dashboard-theme .dashboard-widget-help-text {
  margin: 0;
  color: #596461;
  font-size: .66rem;
  font-weight: 650;
  line-height: 1.5;
}

/* A third action is now present in these headers (help + maximize + close).
   Reserve its width so status chips and titles never sit underneath it. */
.dashboard-theme .stock-compact-widget.has-dashboard-widget-help > .card-heading,
.dashboard-theme .purchase-compact-widget.has-dashboard-widget-help > .card-heading,
.dashboard-theme .production-compact-widget.has-dashboard-widget-help > .card-heading,
.dashboard-theme .delivery-compact-widget.has-dashboard-widget-help > .card-heading {
  padding-right: 126px;
}

.dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading > .metric-chip,
.dashboard-theme .delivery-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading > .metric-chip {
  right: 118px;
}

.dashboard-theme .production-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading > .metric-chip,
.dashboard-theme .production-coverage-widget.has-dashboard-widget-help:not(.is-widget-maximized) .production-coverage-summary {
  right: 118px;
}

.dashboard-theme .widget-modal-backdrop > .stock-compact-widget.has-dashboard-widget-help.is-widget-maximized > .card-heading,
.dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.has-dashboard-widget-help.is-widget-maximized > .card-heading,
.dashboard-theme .widget-modal-backdrop > .production-compact-widget.has-dashboard-widget-help.is-widget-maximized > .card-heading,
.dashboard-theme .widget-modal-backdrop > .delivery-compact-widget.has-dashboard-widget-help.is-widget-maximized > .card-heading {
  padding-right: 132px;
}

.dashboard-theme .widget-modal-backdrop > .purchase-compact-widget.has-dashboard-widget-help.is-widget-maximized > .card-heading > .metric-chip,
.dashboard-theme .widget-modal-backdrop > .delivery-compact-widget.has-dashboard-widget-help.is-widget-maximized > .card-heading > .metric-chip {
  right: 120px;
}

@media (max-width: 760px) {
  .dashboard-theme .dashboard-widget-help-flyout {
    width: min(320px, calc(100vw - 18px));
    max-height: min(300px, calc(100vh - 18px));
    padding: 10px 11px;
  }

  .dashboard-theme .stock-compact-widget.has-dashboard-widget-help > .card-heading,
  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help > .card-heading,
  .dashboard-theme .production-compact-widget.has-dashboard-widget-help > .card-heading,
  .dashboard-theme .delivery-compact-widget.has-dashboard-widget-help > .card-heading {
    padding-right: 118px;
  }
}

/* ========================================================================== */
/* Delidips refinement v34 — purchase widget headings with room for controls  */
/* ========================================================================== */

/* Compras has four cards on wide screens. Help/maximize/close plus the metric
   chip occupy the first row, so give the title its own visual row instead of
   squeezing it underneath those controls. */
@media (min-width: 901px) {
  .dashboard-theme .purchase-compact-widget:not(.is-widget-maximized) {
    height: clamp(320px, 37vh, 380px);
    min-height: 320px;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading {
    min-height: 106px;
    margin-bottom: 12px;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading h2 {
    width: calc(100% + 126px);
    max-width: calc(100% + 126px);
    margin-top: 13px;
    padding-right: 4px;
    font-size: clamp(.98rem, 1.05vw, 1.12rem);
    line-height: 1.14;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading .chart-insight {
    width: calc(100% + 126px);
    max-width: calc(100% + 126px);
    margin-top: 6px;
    padding-right: 4px;
  }
}

@media (min-width: 1500px) {
  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading {
    min-height: 112px;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading h2 {
    margin-top: 14px;
  }
}

/* ========================================================================== */
/* Delidips refinement v35 — purchase heading controls on their own row       */
/* ========================================================================== */

/* On the four-column Compras layout the orange eyebrow must not share the
   horizontal line with the metric chip and the three widget actions. Keep the
   controls in the first row and start the complete text block underneath. */
@media (min-width: 901px) {
  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading {
    display: block;
    min-height: 128px;
    margin-bottom: 10px;
    padding-right: 0;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading > div:first-child {
    width: 100%;
    max-width: 100%;
    padding-top: 42px;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading .eyebrow {
    display: flex;
    width: 100%;
    max-width: 100%;
    margin: 0 0 5px;
    white-space: nowrap;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading h2 {
    width: 100%;
    max-width: 100%;
    margin-top: 0;
    padding-right: 0;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading .chart-insight {
    width: 100%;
    max-width: 100%;
    margin-top: 6px;
    padding-right: 0;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading > .metric-chip {
    top: 0;
    right: 118px;
  }

  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading > .widget-control-group {
    top: 0;
    right: 0;
  }
}

@media (min-width: 1500px) {
  .dashboard-theme .purchase-compact-widget.has-dashboard-widget-help:not(.is-widget-maximized) > .card-heading {
    min-height: 132px;
  }
}

/* ========================================================================== */
/* Delidips refinement v36 — delivery route report compact + searchable modal */
/* ========================================================================== */

/* The route preview is only a quick glance. Match the OTIF card height and
   keep five preview rows inside the available space instead of clipping a
   longer list behind the card overflow. */
@media (min-width: 901px) {
  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) {
    height: clamp(430px, 46vh, 490px);
    min-height: 430px;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .routes-mini-chart {
    gap: 7px;
    padding-top: 3px;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .routes-mini-chart .delivery-mini-row {
    min-height: 0;
    padding: 8px 10px;
  }
}

/* A slightly narrower expanded report is enough for the nine columns once
   their padding is compacted. The table stays inside the modal without a
   horizontal spill on normal desktop widths. */
.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized {
  width: min(var(--widget-modal-width, 1120px), calc(100vw - 52px)) !important;
  max-width: 1120px !important;
}

.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .delivery-widget-detail {
  display: grid !important;
  gap: 10px;
}

.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .ranking-table-wrap {
  width: 100%;
  max-height: min(560px, calc(100dvh - 250px));
  overflow-x: hidden;
  overflow-y: auto;
}

.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .delivery-routes-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .delivery-routes-table th,
.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .delivery-routes-table td {
  padding: 9px 8px;
}

.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .delivery-routes-table th {
  font-size: .61rem;
  letter-spacing: .08em;
}

.dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .delivery-routes-table td {
  font-size: .78rem;
}

/* Search belongs to the expanded detail, where hundreds of routes may exist. */
.dashboard-theme .delivery-routes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 0 1px;
}

.dashboard-theme .delivery-routes-search {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(17, 24, 28, .12);
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
}

.dashboard-theme .delivery-routes-search .ui-icon {
  flex: 0 0 auto;
  color: #6d7478;
}

.dashboard-theme .delivery-routes-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: #182126;
  background: transparent;
  font: inherit;
  font-size: .76rem;
  font-weight: 700;
}

.dashboard-theme .delivery-routes-search input::placeholder {
  color: #8a9093;
}

.dashboard-theme .delivery-routes-search:focus-within {
  border-color: rgba(245, 159, 47, .62);
  box-shadow: 0 0 0 3px rgba(245, 159, 47, .11);
}

.dashboard-theme .delivery-routes-search-count {
  flex: 0 0 auto;
  color: #697176;
  font-size: .64rem;
  font-weight: 850;
  white-space: nowrap;
}

/* Route report uses directional arrows instead of the generic SORT/ASC/DESC
   pills. aria-sort remains the accessible source of truth. */
.dashboard-theme .delivery-routes-table th button[data-sort] {
  gap: 5px;
}

.dashboard-theme .delivery-routes-table th button[data-sort]::after {
  min-width: 14px;
  min-height: 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #899093;
  background: transparent;
  content: "↕";
  font-size: .72rem;
  line-height: 1;
  letter-spacing: 0;
}

.dashboard-theme .delivery-routes-table th[aria-sort="ascending"] button[data-sort]::after {
  color: #d88410;
  background: transparent;
  content: "↑";
}

.dashboard-theme .delivery-routes-table th[aria-sort="descending"] button[data-sort]::after {
  color: #d88410;
  background: transparent;
  content: "↓";
}

@media (max-width: 760px) {
  .dashboard-theme .delivery-routes-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-theme .delivery-routes-search-count {
    align-self: flex-end;
  }

  .dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .ranking-table-wrap {
    overflow-x: auto;
  }

  .dashboard-theme .widget-modal-backdrop > .delivery-routes-widget.is-widget-maximized .delivery-routes-table {
    min-width: 920px;
  }
}

/* ========================================================================== */
/* Delidips refinement v37 — compact route preview rows                       */
/* ========================================================================== */

/* Keep the compact route report visually aligned with OTIF, but use the
   available height more efficiently. Five routes must fit completely without
   clipping the last row or turning each preview item into an oversized band. */
@media (min-width: 901px) {
  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) > .card-heading {
    min-height: 78px;
    margin-bottom: 5px;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .delivery-widget-preview {
    min-height: 0;
    overflow: hidden;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .routes-mini-chart {
    align-content: start;
    gap: 5px;
    padding-top: 1px;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .routes-mini-chart .delivery-mini-row {
    grid-template-columns: minmax(150px, .9fr) minmax(0, 1.55fr) minmax(88px, .58fr);
    min-height: 43px;
    padding: 5px 8px;
    gap: 9px;
    border-radius: 12px;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .routes-mini-chart .delivery-mini-label {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 5px;
    align-items: center;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .routes-mini-chart .delivery-mini-label b {
    margin-top: 0;
    font-size: .61rem;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .routes-mini-chart .delivery-mini-label em {
    display: block;
    overflow: hidden;
    font-size: .56rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .route-mini-progress-wrap {
    gap: 3px;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .routes-mini-chart .delivery-mini-track {
    height: 8px;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .route-mini-progress-caption {
    font-size: .52rem;
    line-height: 1.05;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .route-mini-summary {
    gap: 1px;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .route-mini-status {
    min-height: 20px;
    padding: 2px 8px;
    font-size: .53rem;
  }

  .dashboard-theme .delivery-routes-widget:not(.is-widget-maximized) .route-mini-summary em {
    font-size: .51rem;
    line-height: 1.05;
  }
}

/* SMTP configuration */
#config-panel-smtp {
  --smtp-border: rgba(42, 49, 46, .12);
  --smtp-control-border: #cbd0ca;
  --smtp-text: #202824;
  --smtp-muted: #68706c;
  --smtp-surface: rgba(255, 253, 248, .94);
}

.configuration-smtp-shell {
  display: grid;
  gap: 7px;
}

.configuration-smtp-heading,
.configuration-smtp-card-heading,
.configuration-smtp-footer,
.configuration-smtp-actions,
.configuration-smtp-test {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.configuration-smtp-heading {
  min-height: 48px;
  align-items: flex-start;
  padding: 0 1px 3px;
}

.configuration-smtp-heading .eyebrow {
  font-size: .58rem;
  line-height: 1;
}

.configuration-smtp-heading h2,
.configuration-smtp-card-heading h3 {
  margin: 0;
  color: var(--smtp-text);
  font-weight: 850;
}

.configuration-smtp-heading h2 {
  margin-top: 1px;
  font-size: 1.12rem;
  line-height: 1.1;
}

.configuration-smtp-heading p,
.configuration-smtp-card-heading p {
  margin: 2px 0 0;
  color: var(--smtp-muted);
  line-height: 1.2;
}

.configuration-smtp-heading p {
  font-size: .69rem;
}

.configuration-smtp-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--smtp-border);
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  color: #626a66;
  font-size: .66rem;
  font-weight: 800;
  white-space: nowrap;
}

.configuration-smtp-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9a9f9c;
}

.configuration-smtp-state.is-ready {
  color: #2d6b4d;
  border-color: rgba(45,107,77,.24);
  background: rgba(45,107,77,.07);
}

.configuration-smtp-state.is-ready .configuration-smtp-state-dot { background: #2d6b4d; }

.configuration-smtp-state.is-warning {
  color: #8a641f;
  border-color: rgba(196,139,36,.25);
  background: rgba(245,159,47,.08);
}

.configuration-smtp-state.is-warning .configuration-smtp-state-dot { background: #d99325; }

.configuration-smtp-state.is-error {
  color: #913c2d;
  border-color: rgba(145,60,45,.24);
  background: rgba(145,60,45,.06);
}

.configuration-smtp-state.is-error .configuration-smtp-state-dot { background: #b14c38; }

.configuration-smtp-form {
  display: grid;
  gap: 7px;
}

.configuration-smtp-form.is-busy { opacity: .78; }

.configuration-smtp-primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr);
  gap: 7px;
}

.configuration-smtp-card {
  padding: 10px 12px;
  border: 1px solid var(--smtp-border);
  border-radius: 14px;
  background: var(--smtp-surface);
}

.configuration-smtp-card-heading {
  align-items: flex-start;
  min-height: 26px;
  margin-bottom: 7px;
}

.configuration-smtp-card-heading h3 {
  font-size: .82rem;
  line-height: 1.1;
}

.configuration-smtp-card-heading p {
  font-size: .62rem;
}

.configuration-smtp-enable {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 27px;
  padding: 4px 8px;
  border: 1px solid var(--smtp-border);
  border-radius: 8px;
  background: #fff;
  color: var(--smtp-text);
  font-size: .65rem;
  font-weight: 800;
  white-space: nowrap;
}

.configuration-smtp-enable input,
.configuration-smtp-clear-secret input { accent-color: #16211e; }

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

.configuration-smtp-grid.is-connection {
  grid-template-columns: minmax(190px, 1.6fr) minmax(70px, .42fr) minmax(130px, .78fr) minmax(90px, .5fr);
}

.configuration-smtp-grid.is-auth-main {
  grid-template-columns: minmax(190px, .72fr) minmax(240px, 1.28fr);
}

.configuration-smtp-grid.is-oauth {
  grid-template-columns: minmax(150px, .85fr) minmax(180px, 1fr) minmax(160px, .9fr) minmax(170px, 1fr) minmax(230px, 1.35fr);
}

.configuration-smtp-grid.is-basic {
  grid-template-columns: minmax(260px, 480px);
}

.configuration-smtp-field {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0;
}

.configuration-smtp-field.is-wide { grid-column: span 2; }

.configuration-smtp-field > span,
.configuration-smtp-field > label:first-child {
  color: #55605b;
  font-size: .64rem;
  font-weight: 800;
  line-height: 1.15;
}

.configuration-smtp-field input,
.configuration-smtp-field select {
  width: 100%;
  min-height: 34px;
  height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--smtp-control-border);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--smtp-text);
  font: inherit;
  font-size: .73rem;
}

.configuration-smtp-field input:focus,
.configuration-smtp-field select:focus {
  border-color: rgba(245,159,47,.8);
  box-shadow: 0 0 0 2px rgba(245,159,47,.11);
}

.configuration-smtp-field small {
  min-height: 10px;
  color: var(--smtp-muted);
  font-size: .56rem;
  line-height: 1.05;
}

.configuration-smtp-unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  height: 34px;
  border: 1px solid var(--smtp-control-border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.configuration-smtp-unit-input:focus-within {
  border-color: rgba(245,159,47,.8);
  box-shadow: 0 0 0 2px rgba(245,159,47,.11);
}

.configuration-smtp-unit-input input {
  height: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
}

.configuration-smtp-unit-input span {
  padding: 0 8px 0 2px;
  color: var(--smtp-muted);
  font-size: .6rem;
  font-weight: 800;
}

.configuration-smtp-auth-card { padding-bottom: 9px; }

.configuration-smtp-auth-panel {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--smtp-border);
}

.configuration-smtp-auth-panel[hidden],
.configuration-smtp-field[hidden] { display: none !important; }

.configuration-smtp-clear-secret {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  color: #737a76;
  font-size: .56rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

.configuration-smtp-clear-secret input {
  width: 12px;
  min-height: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.configuration-smtp-clear-secret:has(input:disabled) {
  opacity: .48;
  cursor: default;
}

.configuration-smtp-footer {
  min-height: 49px;
  padding: 5px 7px;
  border: 1px solid var(--smtp-border);
  border-radius: 12px;
  background: rgba(255,253,248,.72);
}

.configuration-smtp-test {
  justify-content: flex-start;
  flex: 0 1 470px;
}

.configuration-smtp-test .configuration-smtp-field {
  flex: 1 1 285px;
}

.configuration-smtp-test .ghost-button,
.configuration-smtp-actions .primary-button {
  min-height: 34px;
  height: 34px;
  white-space: nowrap;
}

.configuration-smtp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 128px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: .72rem;
  line-height: 1;
  font-weight: 850;
}

.configuration-smtp-button .ui-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.configuration-smtp-button.is-test {
  color: #26322e;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(42,49,46,.16);
}

.configuration-smtp-button.is-save {
  min-width: 162px;
  background: linear-gradient(135deg, #101817, #182622);
  box-shadow: 0 8px 18px rgba(16,24,23,.16);
}

.configuration-smtp-button:disabled {
  cursor: wait;
  opacity: .62;
  transform: none;
  box-shadow: none;
}

.configuration-smtp-footer-status {
  display: grid;
  justify-items: start;
  gap: 2px;
  min-width: 180px;
  flex: 1 1 auto;
}

.configuration-smtp-feedback {
  min-height: 14px;
  color: var(--smtp-muted);
  font-size: .64rem;
  font-weight: 750;
  line-height: 1.15;
}

.configuration-smtp-feedback.is-error { color: #9b3d2d; }
.configuration-smtp-feedback.is-success { color: #2d6b4d; }

.configuration-smtp-updated {
  color: var(--smtp-muted);
  font-size: .57rem;
}

@media (max-width: 1180px) {
  .configuration-smtp-primary-grid { grid-template-columns: 1fr; }
  .configuration-smtp-grid.is-oauth { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .configuration-smtp-field.is-refresh-token { grid-column: span 2; }
  .configuration-smtp-footer { flex-wrap: wrap; }
  .configuration-smtp-footer-status { order: 3; flex-basis: 100%; }
}

@media (max-width: 900px) {
  .configuration-smtp-grid.is-connection,
  .configuration-smtp-grid.is-auth-main,
  .configuration-smtp-grid.is-oauth { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .configuration-smtp-field.is-refresh-token { grid-column: span 2; }
}

@media (max-width: 720px) {
  .configuration-smtp-heading,
  .configuration-smtp-card-heading,
  .configuration-smtp-footer,
  .configuration-smtp-actions,
  .configuration-smtp-test {
    align-items: stretch;
    flex-direction: column;
  }

  .configuration-smtp-grid,
  .configuration-smtp-grid.is-connection,
  .configuration-smtp-grid.is-auth-main,
  .configuration-smtp-grid.is-oauth,
  .configuration-smtp-grid.is-basic {
    grid-template-columns: 1fr;
  }

  .configuration-smtp-field.is-wide,
  .configuration-smtp-field.is-refresh-token { grid-column: auto; }

  .configuration-smtp-enable,
  .configuration-smtp-state { width: fit-content; }

  .configuration-smtp-test,
  .configuration-smtp-actions { width: 100%; }

  .configuration-smtp-test .ghost-button,
  .configuration-smtp-actions .primary-button { width: 100%; }
}


/* ========================================================================== */
/* Stock · Tomas de inventario y evaluación                                  */
/* ========================================================================== */

.dashboard-theme .stock-section-tabs {
  margin-top: 0;
}

.dashboard-theme .stock-tabbed-shell {
  min-height: 0;
}

.dashboard-theme .inventory-take-panel {
  min-height: 0;
}

.dashboard-theme .inventory-take-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 2px 0 12px;
  padding: 0 2px;
}

.dashboard-theme .inventory-take-header h2 {
  margin: 4px 0 2px;
  font-size: 1.16rem;
  line-height: 1.15;
}

.dashboard-theme .inventory-take-header p {
  margin: 0;
  color: var(--muted);
  font-size: .68rem;
}

.dashboard-theme .inventory-take-period {
  flex: 0 0 auto;
  max-width: 44%;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.62);
  color: #66716d;
  font-size: .62rem;
  font-weight: 780;
  text-align: right;
}

.dashboard-theme .inventory-take-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.dashboard-theme .inventory-take-list-card,
.dashboard-theme .inventory-evaluation-card {
  min-width: 0;
  padding: 14px;
}

.dashboard-theme .inventory-take-list-card .card-heading,
.dashboard-theme .inventory-evaluation-card .card-heading {
  min-height: 18px;
  margin-bottom: 10px;
}

.dashboard-theme .inventory-module-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 86px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.44);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  text-align: center;
}

.dashboard-theme .inventory-module-state.is-error {
  border-color: rgba(171, 63, 43, .28);
  background: rgba(171, 63, 43, .07);
  color: #9c3e2d;
}

.dashboard-theme .inventory-take-list {
  display: grid;
  gap: 7px;
  max-height: 615px;
  padding-right: 3px;
  overflow: auto;
}

.dashboard-theme .inventory-take-summary-card {
  margin-top: 12px;
}

.dashboard-theme .inventory-take-summary-card .inventory-take-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 300px;
}

.dashboard-theme .inventory-take-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(20, 29, 31, .10);
  border-radius: 12px;
  background: rgba(255,255,255,.62);
}

.dashboard-theme .inventory-take-date {
  display: grid;
  gap: 2px;
  align-content: center;
}

.dashboard-theme .inventory-take-date span {
  color: #11181c;
  font-size: .72rem;
  font-weight: 860;
}

.dashboard-theme .inventory-take-date small,
.dashboard-theme .inventory-take-main small {
  color: #8a928e;
  font-size: .55rem;
  font-weight: 690;
}

.dashboard-theme .inventory-take-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dashboard-theme .inventory-take-main strong {
  overflow: hidden;
  color: #1c2828;
  font-size: .66rem;
  font-weight: 840;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .inventory-take-main span {
  overflow: hidden;
  color: #626e69;
  font-size: .58rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .inventory-take-compare,
.dashboard-theme .inventory-evaluate-button {
  border: 0;
  border-radius: 999px;
  background: #11181c;
  color: #fff;
  font-family: inherit;
  font-weight: 820;
  cursor: pointer;
}

.dashboard-theme .inventory-take-compare {
  min-height: 30px;
  padding: 6px 10px;
  font-size: .57rem;
}

.dashboard-theme .inventory-take-compare:disabled,
.dashboard-theme .inventory-evaluate-button:disabled {
  opacity: .38;
  cursor: default;
}

.dashboard-theme .inventory-evaluation-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.52);
}

.dashboard-theme .inventory-evaluation-controls label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.dashboard-theme .inventory-evaluation-controls label > span {
  color: #68736e;
  font-size: .64rem;
  font-weight: 820;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.dashboard-theme .inventory-evaluation-controls select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(20,29,31,.16);
  border-radius: 9px;
  background: rgba(255,255,255,.92);
  color: #1f2928;
  font: inherit;
  font-size: .82rem;
  font-weight: 780;
}

.dashboard-theme .inventory-compare-arrow {
  align-self: end;
  display: grid;
  place-items: center;
  width: 28px;
  height: 34px;
  color: #8b938f;
  font-size: 1rem;
}

.dashboard-theme .inventory-evaluate-button {
  min-height: 40px;
  padding: 7px 18px;
  font-size: .70rem;
}

.dashboard-theme .inventory-evaluation-result {
  min-width: 0;
}

.dashboard-theme .inventory-evaluation-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 9px;
}

.dashboard-theme .inventory-evaluation-kpis article {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(20,29,31,.10);
  border-radius: 11px;
  background: rgba(255,255,255,.63);
}

.dashboard-theme .inventory-evaluation-kpis span {
  overflow: hidden;
  color: #78817d;
  font-size: .61rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .inventory-evaluation-kpis strong {
  color: #17201f;
  font-size: 1.08rem;
  font-weight: 880;
  line-height: 1;
}

.dashboard-theme .inventory-evaluation-kpis strong.is-positive,
.dashboard-theme .inventory-variation.is-positive {
  color: #2d6e57;
}

.dashboard-theme .inventory-evaluation-kpis strong.is-negative,
.dashboard-theme .inventory-variation.is-negative {
  color: #aa3d2a;
}

.dashboard-theme .inventory-evaluation-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.dashboard-theme .inventory-evaluation-search {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 220px;
  flex: 1 1 360px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.78);
}

.dashboard-theme .inventory-evaluation-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #26302f;
  font: inherit;
  font-size: .68rem;
}

.dashboard-theme .inventory-evaluation-only-differences {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #5f6965;
  font-size: .64rem;
  font-weight: 720;
  white-space: nowrap;
}

.dashboard-theme .inventory-evaluation-toolbar > span {
  margin-left: auto;
  color: #8a928e;
  font-size: .62rem;
  font-weight: 720;
  white-space: nowrap;
}

.dashboard-theme .inventory-evaluation-table-wrap {
  max-height: 500px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.72);
}

.dashboard-theme .inventory-evaluation-table {
  width: max(100%, 1540px);
  border-collapse: separate;
  border-spacing: 0;
  font-size: .64rem;
}

.dashboard-theme .inventory-evaluation-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  background: #f6f2e9;
  color: #626d68;
  font-size: .58rem;
  font-weight: 850;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .025em;
  white-space: nowrap;
}

.dashboard-theme .inventory-evaluation-table td {
  padding: 7px;
  border-bottom: 1px solid rgba(20,29,31,.07);
  color: #384340;
  vertical-align: middle;
  white-space: nowrap;
}

.dashboard-theme .inventory-evaluation-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-theme .inventory-evaluation-table .number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .inventory-evaluation-article {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 245px;
  max-width: 245px;
  background: #fbf8f1;
  box-shadow: 1px 0 0 rgba(20,29,31,.07);
}

.dashboard-theme .inventory-evaluation-article strong,
.dashboard-theme .inventory-evaluation-article span,
.dashboard-theme .inventory-evaluation-article small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .inventory-evaluation-article strong {
  color: #1c2725;
  font-size: .69rem;
  font-weight: 820;
}

.dashboard-theme .inventory-evaluation-article span,
.dashboard-theme .inventory-evaluation-article small {
  margin-top: 2px;
  color: #828b87;
  font-size: .57rem;
}

.dashboard-theme .inventory-drilldown-link {
  padding: 2px 5px;
  border: 0;
  border-bottom: 1px dashed currentColor;
  background: transparent;
  color: #1e665d;
  font: inherit;
  font-size: .66rem;
  font-weight: 830;
  cursor: pointer;
}

.dashboard-theme .inventory-zero {
  color: #a5aaa8;
}

.dashboard-theme .inventory-variation {
  font-weight: 840;
}

.dashboard-theme .inventory-variation-value {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 100%;
  border-bottom: 1px dashed rgba(30, 102, 93, .35);
  cursor: help;
}

.dashboard-theme .inventory-variation-value:focus-visible {
  outline: 2px solid rgba(30, 102, 93, .28);
  outline-offset: 2px;
  border-radius: 4px;
}

.dashboard-theme .inventory-variation-value[data-tooltip]:hover::after,
.dashboard-theme .inventory-variation-value[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 12;
  width: max-content;
  max-width: min(360px, 42vw);
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(20, 29, 31, .96);
  color: #fbf8f1;
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.38;
  text-align: left;
  white-space: normal;
  box-shadow: 0 12px 32px rgba(12, 16, 18, .22);
}

.dashboard-theme .inventory-variation-value[data-tooltip]:hover::before,
.dashboard-theme .inventory-variation-value[data-tooltip]:focus-visible::before {
  content: "";
  position: absolute;
  right: 10px;
  bottom: calc(100% + 2px);
  z-index: 11;
  border-width: 6px;
  border-style: solid;
  border-color: rgba(20, 29, 31, .96) transparent transparent transparent;
}

.dashboard-theme .inventory-evaluation-empty {
  padding: 22px !important;
  color: #858e8a !important;
  text-align: center !important;
}

.dashboard-theme .inventory-evaluation-hint {
  margin: 7px 2px 0;
  color: #8a928f;
  font-size: .54rem;
}

.dashboard-theme .inventory-drilldown-modal {
  width: min(1020px, calc(100vw - 34px));
  max-height: min(760px, calc(100vh - 34px));
}

.dashboard-theme .inventory-drilldown-modal .inventory-module-state {
  min-height: 110px;
}

.dashboard-theme .inventory-drilldown-summary {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .7fr);
}

.dashboard-theme .inventory-drilldown-table-wrap {
  max-height: min(480px, 55vh);
}

.dashboard-theme .inventory-drilldown-table {
  min-width: 720px;
}

@media (max-width: 1180px) {
  .dashboard-theme .inventory-take-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .inventory-take-list {
    max-height: 330px;
  }

  .dashboard-theme .inventory-take-summary-card .inventory-take-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .inventory-take-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-theme .inventory-take-period {
    max-width: 100%;
    text-align: left;
  }

  .dashboard-theme .inventory-evaluation-controls {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .inventory-compare-arrow {
    display: none;
  }

  .dashboard-theme .inventory-evaluation-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .inventory-evaluation-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-theme .inventory-evaluation-search {
    min-width: 0;
    flex-basis: auto;
  }

  .dashboard-theme .inventory-evaluation-toolbar > span {
    margin-left: 0;
  }

  .dashboard-theme .inventory-take-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .dashboard-theme .inventory-take-compare {
    grid-column: 1 / -1;
  }
}


/* Stock · evaluación de inventario — tabla compacta en card normal */
@media (min-width: 1181px) {
  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table-wrap {
    overflow-x: hidden;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: .53rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table th,
  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table td {
    padding: 6px 3px;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table th {
    font-size: .49rem;
    line-height: 1.05;
    white-space: normal;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-article {
    min-width: 0;
    max-width: none;
    width: 19%;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table th:nth-child(2),
  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table td:nth-child(2) {
    width: 4%;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table th:nth-child(n+3),
  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table td:nth-child(n+3) {
    width: 6.42%;
  }
}

/* Stock · evaluación de inventario — alcance comparable + modal amplio */
.dashboard-theme .inventory-take-scope-note {
  display: block;
  min-height: 25px;
  margin-top: 1px;
  color: #7b8580;
  font-size: .58rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
}

.dashboard-theme .inventory-take-main .inventory-take-scope {
  color: #4f625c;
  font-weight: 760;
}

.dashboard-theme .inventory-take-row.is-comparison-candidate {
  border-color: rgba(20, 29, 31, .16);
}

.dashboard-theme .inventory-take-row.is-comparison-compatible {
  border-color: rgba(49, 112, 83, .34);
  background: rgba(239, 248, 243, .86);
}

.dashboard-theme .inventory-take-row.is-comparison-recommended {
  border-color: rgba(38, 100, 72, .52);
  box-shadow: inset 3px 0 0 rgba(38, 100, 72, .72);
}

.dashboard-theme .inventory-take-row.is-comparison-selected {
  outline: 1px solid rgba(20, 29, 31, .20);
  outline-offset: 1px;
}

.dashboard-theme .inventory-comparison-match {
  margin: -2px 0 10px;
  padding: 7px 10px;
  border: 1px solid rgba(20, 29, 31, .12);
  border-radius: 10px;
  color: #56615d;
  background: rgba(255, 255, 255, .58);
  font-size: .55rem;
  font-weight: 720;
  line-height: 1.35;
}

.dashboard-theme .inventory-comparison-match.is-match {
  border-color: rgba(49, 112, 83, .26);
  color: #2f694f;
  background: rgba(239, 248, 243, .84);
}

.dashboard-theme .inventory-comparison-match.is-warning {
  border-color: rgba(181, 124, 30, .28);
  color: #805c1c;
  background: rgba(255, 248, 229, .84);
}

/* En modo ampliado la evaluación utiliza prácticamente todo el viewport.
   La tabla se compacta sólo en ese estado para que sus 14 columnas entren
   simultáneamente en pantallas de escritorio sin scroll horizontal. */
.dashboard-theme .widget-modal-backdrop:has(> .inventory-evaluation-card.is-widget-maximized) {
  padding: 14px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized {
  width: calc(100vw - 28px) !important;
  max-width: calc(100vw - 28px) !important;
  height: calc(100dvh - 28px) !important;
  max-height: calc(100dvh - 28px) !important;
  padding: 14px 16px !important;
  overflow: hidden !important;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .card-heading {
  flex: 0 0 auto;
  margin-bottom: 7px;
  padding: 0 0 5px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-controls {
  flex: 0 0 auto;
  margin-bottom: 7px;
  padding: 8px 9px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-kpis {
  flex: 0 0 auto;
  margin-bottom: 7px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-toolbar {
  flex: 0 0 auto;
  margin-bottom: 6px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: .58rem;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table th,
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table td {
  padding: 6px 4px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table th {
  font-size: .52rem;
  line-height: 1.08;
  white-space: normal;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-article {
  min-width: 0;
  max-width: none;
  width: 19%;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table th:nth-child(2),
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table td:nth-child(2) {
  width: 4.5%;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table th:nth-child(n+3),
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table td:nth-child(n+3) {
  width: 6.38%;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-hint {
  flex: 0 0 auto;
  margin-top: 5px;
}

@media (max-width: 900px) {
  .dashboard-theme .widget-modal-backdrop:has(> .inventory-evaluation-card.is-widget-maximized) {
    padding: 6px;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized {
    width: calc(100vw - 12px) !important;
    max-width: calc(100vw - 12px) !important;
    height: calc(100dvh - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table-wrap {
    overflow-x: auto;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table {
    width: max(100%, 1180px);
    table-layout: auto;
  }
}


/* Stock · vista unificada y evaluación compacta */
.dashboard-theme .stock-unified-shell {
  min-height: 0;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 8px;
  margin-bottom: 8px;
  padding: 8px;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-compare-arrow,
.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-take-scope-note {
  display: none;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls select {
  height: 34px;
  padding: 0 9px;
  font-size: .65rem;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluate-button {
  grid-column: 1 / -1;
  justify-self: end;
  min-width: 96px;
  min-height: 32px;
  padding: 6px 14px;
  font-size: .62rem;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-comparison-match {
  margin: -1px 0 7px;
  padding: 6px 8px;
  font-size: .52rem;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-module-state {
  min-height: 48px;
  padding: 8px 10px;
  font-size: .60rem;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 0;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-kpis article {
  gap: 3px;
  padding: 7px 8px;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-kpis span {
  font-size: .55rem;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-kpis strong {
  font-size: .86rem;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-toolbar,
.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-table-wrap,
.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-hint {
  display: none;
}

@media (max-width: 760px) {
  .dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls,
  .dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-kpis {
    grid-template-columns: 1fr;
  }
}


/* Stock · refinamiento de inventario: orden de cards, historial compacto y tabla ampliada */
.dashboard-theme .stock-inventory-history-widget.inventory-take-summary-card {
  margin-top: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-theme .stock-inventory-history-widget .inventory-take-list {
  grid-template-columns: 1fr;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.dashboard-theme .stock-inventory-history-widget .inventory-module-state {
  min-height: 48px;
  padding: 8px 10px;
  font-size: .60rem;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-article {
  width: 14.5%;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table th:nth-child(2),
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table td:nth-child(2) {
  width: 4.5%;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table th:nth-child(n+3),
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table td:nth-child(n+3) {
  width: 6.75%;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table .number-cell {
  font-size: .60rem;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-drilldown-link,
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-variation-value {
  font-size: inherit;
  line-height: inherit;
}

/* Stock · ajustes finos de evaluación e historial */
.dashboard-theme .inventory-evaluation-table td,
.dashboard-theme .inventory-evaluation-table .inventory-drilldown-link,
.dashboard-theme .inventory-evaluation-table .inventory-variation-value {
  font-size: inherit;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .inventory-evaluation-table .inventory-drilldown-link {
  padding: 2px 0;
  font-family: inherit;
}

.dashboard-theme .inventory-evaluation-table th.is-sortable {
  padding: 0;
}

.dashboard-theme .inventory-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  padding: 8px 7px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-theme .inventory-evaluation-table th.number-cell .inventory-sort-button {
  justify-content: flex-end;
  text-align: right;
}

.dashboard-theme .inventory-sort-button-indicator {
  flex: 0 0 auto;
  color: #8a928e;
  font-size: .72rem;
  line-height: 1;
}

.dashboard-theme .inventory-sort-button.is-active,
.dashboard-theme .inventory-sort-button:hover {
  color: #1b2625;
}

.dashboard-theme .inventory-sort-button.is-active .inventory-sort-button-indicator,
.dashboard-theme .inventory-sort-button:hover .inventory-sort-button-indicator {
  color: #1e665d;
}

.dashboard-theme .stock-inventory-history-widget {
  height: clamp(330px, 42vh, 420px);
}

.dashboard-theme .stock-inventory-history-widget > .card-heading {
  min-height: 70px;
  margin-bottom: 14px;
  padding-right: 124px;
}

.dashboard-theme .stock-inventory-history-widget > .card-heading > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-theme .stock-inventory-history-widget > .card-heading .chart-insight {
  white-space: normal;
}

.dashboard-theme .stock-inventory-history-widget > .card-heading > .metric-chip {
  margin-top: 2px;
}

.dashboard-theme .stock-inventory-history-widget .inventory-take-list,
.dashboard-theme .stock-inventory-history-widget .inventory-module-state {
  margin-top: 2px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table {
  font-size: .59rem;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table th,
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table td {
  padding: 6px 4px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-article {
  width: 15%;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table th:nth-child(2),
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table td:nth-child(2) {
  width: 4.5%;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table th:nth-child(n+3),
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table td:nth-child(n+3) {
  width: 6.71%;
}

@media (max-width: 760px) {
  .dashboard-theme .stock-inventory-history-widget > .card-heading {
    min-height: 0;
    padding-right: 88px;
  }
}

/* Stock · resaltado del artículo consultado en detalles anidados */
.dashboard-theme .inventory-production-material-highlight > td,
.dashboard-theme .inventory-stock-movement-highlight > td {
  background: rgba(245, 159, 47, .13);
  box-shadow: inset 0 1px 0 rgba(216, 132, 16, .14), inset 0 -1px 0 rgba(216, 132, 16, .14);
}

.dashboard-theme .inventory-production-material-highlight > td:first-child,
.dashboard-theme .inventory-stock-movement-highlight > td:first-child {
  box-shadow: inset 3px 0 0 #d88410, inset 0 1px 0 rgba(216, 132, 16, .14), inset 0 -1px 0 rgba(216, 132, 16, .14);
}

.dashboard-theme .inventory-production-material-name {
  display: inline;
}

.dashboard-theme .inventory-production-material-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 6px;
  border: 1px solid rgba(216, 132, 16, .26);
  border-radius: 999px;
  background: rgba(245, 159, 47, .12);
  color: #8b5a12;
  font-size: .56rem;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

/* Stock · remitos resaltados, ayuda de cálculo e impresión A4 */
.dashboard-theme .inventory-purchase-receipt-highlight > td {
  background: rgba(245, 159, 47, .13);
  box-shadow: inset 0 1px 0 rgba(216, 132, 16, .14), inset 0 -1px 0 rgba(216, 132, 16, .14);
}

.dashboard-theme .inventory-purchase-receipt-highlight > td:first-child {
  box-shadow: inset 3px 0 0 #d88410, inset 0 1px 0 rgba(216, 132, 16, .14), inset 0 -1px 0 rgba(216, 132, 16, .14);
}

.dashboard-theme .inventory-real-value {
  color: inherit;
}

.dashboard-theme .inventory-print-button,
.dashboard-theme .inventory-print-summary {
  display: none;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .inventory-evaluation-heading {
  position: relative;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
  position: absolute;
  top: 1px;
  right: 102px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(20, 29, 31, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  color: #24302e;
  font: inherit;
  font-size: .62rem;
  font-weight: 820;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 29, 31, .06);
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button:hover {
  border-color: rgba(30, 102, 93, .28);
  background: rgba(244, 249, 247, .98);
  color: #1e665d;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button:focus-visible {
  outline: 2px solid rgba(30, 102, 93, .32);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
    position: static;
    margin-left: auto;
  }
}

@page {
  size: A4 landscape;
  margin: 6mm;
}

@media print {
  html,
  body {
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.inventory-evaluation-printing > * {
    display: none !important;
  }

  body.inventory-evaluation-printing > .widget-modal-backdrop {
    position: static !important;
    inset: auto !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body.inventory-evaluation-printing > .widget-modal-backdrop > * {
    display: none !important;
  }

  body.inventory-evaluation-printing > .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized {
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-card > .card-heading {
    display: block !important;
    margin: 0 0 2.5mm !important;
    padding: 0 0 1.8mm !important;
    border-bottom: .3mm solid #222 !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-card > .card-heading .eyebrow,
  body.inventory-evaluation-printing .inventory-evaluation-card > .card-heading .chart-insight,
  body.inventory-evaluation-printing .inventory-evaluation-card .widget-control-group,
  body.inventory-evaluation-printing .inventory-evaluation-card .inventory-print-button,
  body.inventory-evaluation-printing .inventory-evaluation-card .inventory-evaluation-controls,
  body.inventory-evaluation-printing .inventory-evaluation-card .inventory-comparison-match,
  body.inventory-evaluation-printing .inventory-evaluation-card .inventory-module-state,
  body.inventory-evaluation-printing .inventory-evaluation-card .inventory-evaluation-toolbar,
  body.inventory-evaluation-printing .inventory-evaluation-card .inventory-evaluation-hint {
    display: none !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-card > .card-heading h2 {
    margin: 0 !important;
    color: #111 !important;
    font-size: 11pt !important;
    line-height: 1.1 !important;
    letter-spacing: 0 !important;
  }

  body.inventory-evaluation-printing .inventory-print-summary {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2mm 4mm;
    margin: 0 0 2.5mm !important;
    padding: 0 0 2mm !important;
    border-bottom: .2mm solid #aaa;
  }

  body.inventory-evaluation-printing .inventory-print-summary span {
    display: grid;
    gap: .5mm;
    min-width: 0;
  }

  body.inventory-evaluation-printing .inventory-print-summary strong {
    color: #555 !important;
    font-size: 5.6pt !important;
    font-weight: 800 !important;
    text-transform: uppercase;
  }

  body.inventory-evaluation-printing .inventory-print-summary b {
    color: #111 !important;
    font-size: 6.2pt !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-result {
    display: block !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-kpis {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 1.5mm !important;
    margin: 0 0 2.5mm !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-kpis article {
    display: grid !important;
    gap: .5mm !important;
    padding: 1.2mm 1.5mm !important;
    border: .2mm solid #aaa !important;
    border-radius: 0 !important;
    background: #fff !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-kpis span {
    color: #555 !important;
    font-size: 5pt !important;
    line-height: 1 !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-kpis strong {
    color: #111 !important;
    font-size: 7pt !important;
    line-height: 1 !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-table-wrap {
    display: block !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-table {
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    color: #111 !important;
    font-size: 5pt !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-table thead {
    display: table-header-group !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.inventory-evaluation-printing .inventory-evaluation-table th {
    position: static !important;
    padding: 1mm .45mm !important;
    border: .2mm solid #999 !important;
    background: #eee !important;
    color: #111 !important;
    font-size: 4.4pt !important;
    line-height: 1.08 !important;
    white-space: normal !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-table td {
    position: static !important;
    padding: .75mm .45mm !important;
    border: .2mm solid #ccc !important;
    background: #fff !important;
    color: #111 !important;
    font-size: 4.8pt !important;
    line-height: 1.08 !important;
    white-space: nowrap !important;
    box-shadow: none !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-table th:first-child,
  body.inventory-evaluation-printing .inventory-evaluation-table td:first-child {
    width: 17% !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-table th:nth-child(2),
  body.inventory-evaluation-printing .inventory-evaluation-table td:nth-child(2) {
    width: 4% !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-table th:nth-child(n+3),
  body.inventory-evaluation-printing .inventory-evaluation-table td:nth-child(n+3) {
    width: 6.58% !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-article {
    min-width: 0 !important;
    max-width: none !important;
    white-space: normal !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-article strong,
  body.inventory-evaluation-printing .inventory-evaluation-article span,
  body.inventory-evaluation-printing .inventory-evaluation-article small {
    overflow: visible !important;
    color: #111 !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-article strong {
    font-size: 4.9pt !important;
    line-height: 1.08 !important;
  }

  body.inventory-evaluation-printing .inventory-evaluation-article span,
  body.inventory-evaluation-printing .inventory-evaluation-article small {
    margin-top: .3mm !important;
    font-size: 4.1pt !important;
    line-height: 1.05 !important;
  }

  body.inventory-evaluation-printing .inventory-sort-button {
    display: inline !important;
    width: auto !important;
    padding: 0 !important;
    color: #111 !important;
    font-size: inherit !important;
    line-height: inherit !important;
  }

  body.inventory-evaluation-printing .inventory-sort-button-indicator {
    display: none !important;
  }

  body.inventory-evaluation-printing .inventory-drilldown-link,
  body.inventory-evaluation-printing .inventory-variation-value,
  body.inventory-evaluation-printing .inventory-real-value {
    padding: 0 !important;
    border: 0 !important;
    color: #111 !important;
    font: inherit !important;
    line-height: inherit !important;
    text-decoration: none !important;
  }

  body.inventory-evaluation-printing .inventory-variation-value::before,
  body.inventory-evaluation-printing .inventory-variation-value::after {
    display: none !important;
    content: none !important;
  }
}

/* Stock v8 · optimización del encabezado de evaluación para mostrar más filas */
@media (min-width: 1181px) {
  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) > .card-heading,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .card-heading {
    margin-bottom: 6px;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) > .card-heading h2,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .card-heading h2 {
    font-size: 1.02rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) > .card-heading .chart-insight,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .card-heading .chart-insight {
    margin-top: 3px;
    font-size: .72rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-controls,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-controls {
    gap: 6px;
    margin-bottom: 6px;
    padding: 7px 8px;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-controls label > span,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-controls label > span {
    font-size: .59rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-controls select,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-controls select {
    height: 38px;
    padding: 0 10px;
    font-size: .76rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-take-scope-note,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-take-scope-note {
    min-height: 18px;
    font-size: .53rem;
    line-height: 1.2;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluate-button,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluate-button {
    min-height: 38px;
    min-width: 102px;
    padding: 6px 16px;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-comparison-match,
  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-module-state,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-comparison-match,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-module-state {
    margin-bottom: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
    min-height: 0;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-result,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 620px);
    grid-template-areas:
      "toolbar kpis"
      "table table"
      "hint hint";
    align-items: start;
    gap: 6px 10px;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-kpis,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-kpis {
    grid-area: kpis;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
    align-self: stretch;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-kpis article,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-kpis article {
    gap: 2px;
    padding: 6px 7px;
    border-radius: 10px;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-kpis span,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-kpis span {
    font-size: .53rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-kpis strong,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-kpis strong {
    font-size: .95rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-toolbar,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-toolbar {
    grid-area: toolbar;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-height: 100%;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-search,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-search {
    min-width: 0;
    height: 36px;
    padding: 0 10px;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-search input,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-search input {
    font-size: .66rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-only-differences,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-only-differences {
    justify-self: end;
    font-size: .60rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-toolbar > span,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-toolbar > span {
    margin-left: 0;
    justify-self: end;
    font-size: .58rem;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-table-wrap,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table-wrap {
    grid-area: table;
    margin-top: 0;
  }

  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-hint,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-hint {
    grid-area: hint;
    margin-top: 0;
  }
}

@media (min-width: 1181px) and (max-width: 1450px) {
  .dashboard-theme .inventory-evaluation-card:not(.is-widget-maximized) .inventory-evaluation-result,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "toolbar"
      "kpis"
      "table"
      "hint";
  }
}

/* Stock v9 · correcciones de layout de evaluación */
.dashboard-theme .inventory-evaluation-heading {
  align-items: flex-start;
}

.dashboard-theme .inventory-comparison-match {
  display: none !important;
}

.dashboard-theme .inventory-evaluation-controls {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.dashboard-theme .inventory-compare-arrow {
  display: none !important;
}

.dashboard-theme .inventory-evaluate-button {
  align-self: end;
  justify-self: end;
}

.dashboard-theme .inventory-evaluation-table-wrap {
  min-height: 0;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
}

.dashboard-theme .inventory-evaluation-table td,
.dashboard-theme .inventory-evaluation-table .inventory-drilldown-link,
.dashboard-theme .inventory-evaluation-table .inventory-variation-value,
.dashboard-theme .inventory-evaluation-table .inventory-real-value {
  font-size: .67rem;
}

.dashboard-theme .inventory-evaluation-table .inventory-variation-value,
.dashboard-theme .inventory-evaluation-table .inventory-real-value {
  font-weight: 760;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) > .card-heading {
  margin-bottom: 6px;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) > .card-heading h2 {
  font-size: 1rem;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) > .card-heading .chart-insight {
  margin-top: 3px;
  font-size: .68rem;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 7px 8px;
  margin-bottom: 6px;
  padding: 8px;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls label {
  gap: 4px;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls select {
  height: 36px;
  font-size: .67rem;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-take-scope-note {
  display: none !important;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-module-state {
  margin-bottom: 0;
  min-height: 44px;
  padding: 8px 10px;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-result {
  display: block !important;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-kpis {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-kpis article {
  min-width: 0;
  padding: 7px 8px;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-toolbar,
.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-table-wrap,
.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-hint {
  display: none !important;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .inventory-evaluation-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: static;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
  position: static;
  right: auto;
  top: auto;
  margin-left: auto;
  margin-top: 2px;
  flex: 0 0 auto;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-controls {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 6px 8px;
  margin-bottom: 5px;
  padding: 7px 8px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-take-scope-note {
  min-height: 16px;
  font-size: .52rem;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-module-state {
  margin-bottom: 5px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 640px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "toolbar kpis"
    "table table"
    "hint hint";
  gap: 6px 10px;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-kpis {
  grid-area: kpis;
  margin: 0;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-toolbar {
  grid-area: toolbar;
  margin: 0;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table-wrap {
  grid-area: table;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto !important;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table {
  font-size: .61rem;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table td,
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table .inventory-drilldown-link,
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table .inventory-variation-value,
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table .inventory-real-value {
  font-size: .64rem;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-hint {
  grid-area: hint;
  margin-top: 0;
}

@media (max-width: 1180px) {
  .dashboard-theme .inventory-evaluation-controls,
  .dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-controls {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .inventory-evaluate-button {
    width: 100%;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
    grid-template-columns: 1fr;
    grid-template-areas:
      "toolbar"
      "kpis"
      "table"
      "hint";
  }
}

/* Stock v10 · scroll real del modal + botón de impresión junto al resumen */
.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
  position: relative;
  flex: 1 0 auto;
  min-height: 0;
  overflow: visible;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table-wrap {
  min-height: 320px;
  height: min(58vh, 650px);
  max-height: none;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
  position: absolute;
  top: -34px;
  right: 0;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  margin: 0;
  padding: 4px 10px;
}

@media (max-width: 1180px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table-wrap {
    min-height: 360px;
    height: min(56vh, 620px);
    overflow-x: auto !important;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
    position: static;
    justify-self: end;
    margin-bottom: 4px;
  }
}

/* Stock v11 · corrección final de modal maximizado y botón Imprimir/PDF */
@media (min-width: 1181px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
    position: static;
    display: grid !important;
    flex: 1 1 auto;
    min-height: 0 !important;
    overflow: hidden !important;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 610px) auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "toolbar kpis print"
      "table table table"
      "hint hint hint";
    gap: 6px 8px;
    align-items: center;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-toolbar {
    grid-area: toolbar;
    min-width: 0;
    margin: 0;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-kpis {
    grid-area: kpis;
    min-width: 0;
    margin: 0;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
    grid-area: print;
    position: static !important;
    top: auto !important;
    right: auto !important;
    align-self: center;
    justify-self: end;
    display: inline-flex;
    min-height: 34px;
    height: 34px;
    margin: 0 !important;
    padding: 5px 10px;
    white-space: nowrap;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table-wrap {
    grid-area: table;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    align-self: stretch;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-hint {
    grid-area: hint;
    margin: 0;
  }
}

@media (min-width: 1181px) and (max-width: 1450px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "toolbar toolbar"
      "kpis print"
      "table table"
      "hint hint";
  }
}

@media (max-width: 1180px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized {
    overflow: hidden !important;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
    min-height: 0 !important;
    overflow: hidden !important;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "toolbar"
      "kpis"
      "print"
      "table"
      "hint";
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
    grid-area: print;
    position: static !important;
    justify-self: end;
    margin: 0 !important;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-table-wrap {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: auto !important;
  }
}

/* Stock v12 · posición de Imprimir/PDF y alineación de Evaluar */
.dashboard-theme .inventory-evaluation-controls .inventory-evaluate-button {
  align-self: start;
  margin-top: 18px;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls .inventory-evaluate-button {
  align-self: start;
  margin-top: 18px;
}

@media (min-width: 1181px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .inventory-evaluation-heading {
    position: relative !important;
    min-height: 70px;
    padding-right: 92px !important;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
    position: absolute !important;
    top: 38px !important;
    right: 0 !important;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    height: 30px;
    margin: 0 !important;
    padding: 4px 9px;
    white-space: nowrap;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-controls .inventory-evaluate-button {
    align-self: start;
    margin-top: 18px;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 610px);
    grid-template-areas:
      "toolbar kpis"
      "table table"
      "hint hint";
  }
}

@media (min-width: 1181px) and (max-width: 1450px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "toolbar"
      "kpis"
      "table"
      "hint";
  }
}

@media (max-width: 1180px) {
  .dashboard-theme .inventory-evaluation-controls .inventory-evaluate-button,
  .dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls .inventory-evaluate-button,
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-controls .inventory-evaluate-button {
    margin-top: 0;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .inventory-evaluation-heading {
    position: relative !important;
    padding-right: 88px !important;
    padding-bottom: 36px !important;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
    position: absolute !important;
    top: 36px !important;
    right: 0 !important;
    margin: 0 !important;
  }
}

/* Stock v14 · KPIs compactos y mayor legibilidad de tomas */
.dashboard-theme .stock-kpi-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
}

.dashboard-theme .stock-kpi-grid .customer-account-kpi {
  min-width: 0;
}

.dashboard-theme .stock-kpi-grid .customer-account-kpi-copy > span,
.dashboard-theme .stock-kpi-grid .customer-account-kpi-copy > strong,
.dashboard-theme .stock-kpi-grid .customer-account-kpi-copy > small {
  min-width: 0;
}

.dashboard-theme .stock-kpi-grid .customer-account-kpi-copy > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .stock-inventory-evaluation-widget:not(.is-widget-maximized) .inventory-evaluation-controls select {
  padding-left: 8px;
  padding-right: 24px;
  font-size: .58rem;
  letter-spacing: -.01em;
}

.dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-controls select {
  font-size: .64rem;
  letter-spacing: -.01em;
}

@media (max-width: 1450px) {
  .dashboard-theme .stock-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-theme .stock-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
}

/* Stock v15 · optimización del modal de movimiento y ubicación del botón de impresión */
.dashboard-theme [data-stock-movement-modal] .production-order-detail-modal {
  width: min(1180px, calc(100vw - 28px));
  max-height: min(86vh, calc(100vh - 28px));
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-theme [data-stock-movement-modal] .modal-heading {
  gap: 12px;
  margin-bottom: 8px;
}

.dashboard-theme [data-stock-movement-modal] .modal-heading h2 {
  font-size: 1.24rem;
}

.dashboard-theme [data-stock-movement-modal] .modal-heading p {
  margin-top: 3px;
  font-size: .76rem;
  line-height: 1.25;
}

.dashboard-theme [data-stock-movement-modal] .modal-close-button {
  width: 40px;
  height: 40px;
  font-size: 1.28rem;
}

.dashboard-theme [data-stock-movement-modal] [data-stock-movement-content] {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.dashboard-theme [data-stock-movement-modal] .modal-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.dashboard-theme [data-stock-movement-modal] .modal-summary-grid span {
  padding: 7px 8px;
  border-radius: 12px;
  font-size: .73rem;
}

.dashboard-theme [data-stock-movement-modal] .modal-summary-grid strong {
  margin-bottom: 2px;
  font-size: .62rem;
}

.dashboard-theme [data-stock-movement-modal] .production-order-material-empty {
  margin-top: 2px;
}

.dashboard-theme [data-stock-movement-modal] .modal-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: min(62vh, 620px);
  max-height: none;
  overflow: auto;
  scrollbar-gutter: stable;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table {
  min-width: 740px;
  border-spacing: 0 4px;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table th,
.dashboard-theme [data-stock-movement-modal] .production-order-table td {
  padding: 6px 7px;
  font-size: .76rem;
  line-height: 1.18;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 250, 241, 0.98);
}

.dashboard-theme [data-stock-movement-modal] .production-order-table td:first-child {
  white-space: nowrap;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table td:nth-child(2) {
  line-height: 1.15;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table th:nth-child(1),
.dashboard-theme [data-stock-movement-modal] .production-order-table td:nth-child(1) {
  width: 88px;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table th:nth-child(2),
.dashboard-theme [data-stock-movement-modal] .production-order-table td:nth-child(2) {
  width: 34%;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table th:nth-child(3),
.dashboard-theme [data-stock-movement-modal] .production-order-table td:nth-child(3) {
  width: 12%;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table th:nth-child(4),
.dashboard-theme [data-stock-movement-modal] .production-order-table td:nth-child(4) {
  width: 12%;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table th:nth-child(5),
.dashboard-theme [data-stock-movement-modal] .production-order-table td:nth-child(5) {
  width: 12%;
}

.dashboard-theme [data-stock-movement-modal] .production-order-table th:nth-child(6),
.dashboard-theme [data-stock-movement-modal] .production-order-table td:nth-child(6) {
  width: 10%;
}

@media (min-width: 1181px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized {
    position: relative;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .inventory-evaluation-heading {
    position: relative !important;
    min-height: 72px;
    padding-right: 116px !important;
    margin-bottom: 6px;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
    position: absolute !important;
    top: 40px !important;
    right: 14px !important;
    z-index: 8;
    min-height: 32px;
    height: 32px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .68rem;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(16, 18, 23, 0.10);
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-evaluation-result {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 610px);
    grid-template-areas:
      "toolbar kpis"
      "table table"
      "hint hint";
  }
}

@media (max-width: 980px) {
  .dashboard-theme [data-stock-movement-modal] .production-order-detail-modal {
    width: min(100vw - 18px, 980px);
    max-height: min(90vh, calc(100vh - 18px));
    padding: 12px;
  }

  .dashboard-theme [data-stock-movement-modal] .modal-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme [data-stock-movement-modal] .modal-table-wrap {
    height: min(58vh, 560px);
  }
}

/* Stock v16 · botón imprimir debajo del minimizar + modales compactos en evaluación */
@media (min-width: 1181px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .inventory-evaluation-heading {
    min-height: 96px;
    padding-right: 118px !important;
    padding-bottom: 4px;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
    top: 58px !important;
    right: 14px !important;
    min-height: 34px;
    height: 34px;
    padding: 5px 12px;
    font-size: .69rem;
  }
}

@media (max-width: 1180px) {
  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized > .inventory-evaluation-heading {
    padding-bottom: 44px !important;
  }

  .dashboard-theme .widget-modal-backdrop > .inventory-evaluation-card.is-widget-maximized .inventory-print-button {
    top: 44px !important;
    right: 0 !important;
  }
}

.dashboard-theme [data-stock-production-order-modal] .production-order-detail-modal,
.dashboard-theme [data-stock-purchase-receipt-modal] .production-order-detail-modal,
.dashboard-theme [data-stock-movement-modal] .production-order-detail-modal,
.dashboard-theme .inventory-drilldown-modal {
  width: min(1180px, calc(100vw - 28px));
  max-height: min(86vh, calc(100vh - 28px));
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-theme [data-stock-production-order-modal] .modal-heading,
.dashboard-theme [data-stock-purchase-receipt-modal] .modal-heading,
.dashboard-theme [data-stock-movement-modal] .modal-heading,
.dashboard-theme .inventory-drilldown-modal .modal-heading {
  gap: 12px;
  margin-bottom: 8px;
}

.dashboard-theme [data-stock-production-order-modal] .modal-heading h2,
.dashboard-theme [data-stock-purchase-receipt-modal] .modal-heading h2,
.dashboard-theme [data-stock-movement-modal] .modal-heading h2,
.dashboard-theme .inventory-drilldown-modal .modal-heading h2 {
  font-size: 1.24rem;
}

.dashboard-theme [data-stock-production-order-modal] .modal-heading p,
.dashboard-theme [data-stock-purchase-receipt-modal] .modal-heading p,
.dashboard-theme [data-stock-movement-modal] .modal-heading p,
.dashboard-theme .inventory-drilldown-modal .modal-heading p {
  margin-top: 3px;
  font-size: .76rem;
  line-height: 1.24;
}

.dashboard-theme [data-stock-production-order-modal] .modal-close-button,
.dashboard-theme [data-stock-purchase-receipt-modal] .modal-close-button,
.dashboard-theme [data-stock-movement-modal] .modal-close-button,
.dashboard-theme .inventory-drilldown-modal .modal-close-button {
  width: 40px;
  height: 40px;
  font-size: 1.24rem;
}

.dashboard-theme [data-stock-production-order-modal] [data-stock-production-order-content],
.dashboard-theme [data-stock-purchase-receipt-modal] [data-stock-purchase-receipt-content],
.dashboard-theme [data-stock-movement-modal] [data-stock-movement-content],
.dashboard-theme .inventory-drilldown-modal [data-inventory-drilldown-content] {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.dashboard-theme [data-stock-production-order-modal] .route-modal-state,
.dashboard-theme [data-stock-purchase-receipt-modal] .route-modal-state,
.dashboard-theme [data-stock-movement-modal] .route-modal-state,
.dashboard-theme .inventory-drilldown-modal .inventory-module-state {
  min-height: 56px;
  padding: 10px 12px;
}

.dashboard-theme [data-stock-production-order-modal] .modal-summary-grid,
.dashboard-theme [data-stock-purchase-receipt-modal] .modal-summary-grid,
.dashboard-theme [data-stock-movement-modal] .modal-summary-grid,
.dashboard-theme .inventory-drilldown-summary {
  gap: 6px;
  margin-bottom: 8px;
}

.dashboard-theme [data-stock-production-order-modal] .modal-summary-grid span,
.dashboard-theme [data-stock-purchase-receipt-modal] .modal-summary-grid span,
.dashboard-theme [data-stock-movement-modal] .modal-summary-grid span,
.dashboard-theme .inventory-drilldown-summary span {
  padding: 7px 8px;
  border-radius: 12px;
  font-size: .73rem;
}

.dashboard-theme [data-stock-production-order-modal] .modal-summary-grid strong,
.dashboard-theme [data-stock-purchase-receipt-modal] .modal-summary-grid strong,
.dashboard-theme [data-stock-movement-modal] .modal-summary-grid strong,
.dashboard-theme .inventory-drilldown-summary small {
  margin-bottom: 2px;
  font-size: .62rem;
}

.dashboard-theme [data-stock-production-order-modal] .modal-table-wrap,
.dashboard-theme [data-stock-purchase-receipt-modal] .modal-table-wrap,
.dashboard-theme [data-stock-movement-modal] .modal-table-wrap,
.dashboard-theme .inventory-drilldown-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: min(62vh, 620px);
  max-height: none;
  overflow: auto;
  scrollbar-gutter: stable;
}

.dashboard-theme [data-stock-production-order-modal] .production-order-table,
.dashboard-theme [data-stock-purchase-receipt-modal] .production-order-table,
.dashboard-theme [data-stock-movement-modal] .production-order-table,
.dashboard-theme .inventory-drilldown-table {
  min-width: 740px;
  border-spacing: 0 4px;
}

.dashboard-theme [data-stock-production-order-modal] .production-order-table th,
.dashboard-theme [data-stock-production-order-modal] .production-order-table td,
.dashboard-theme [data-stock-purchase-receipt-modal] .production-order-table th,
.dashboard-theme [data-stock-purchase-receipt-modal] .production-order-table td,
.dashboard-theme [data-stock-movement-modal] .production-order-table th,
.dashboard-theme [data-stock-movement-modal] .production-order-table td,
.dashboard-theme .inventory-drilldown-table th,
.dashboard-theme .inventory-drilldown-table td {
  padding: 6px 7px;
  font-size: .76rem;
  line-height: 1.18;
}

.dashboard-theme [data-stock-production-order-modal] .production-order-table thead th,
.dashboard-theme [data-stock-purchase-receipt-modal] .production-order-table thead th,
.dashboard-theme [data-stock-movement-modal] .production-order-table thead th,
.dashboard-theme .inventory-drilldown-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 250, 241, 0.98);
}

.dashboard-theme [data-stock-production-order-modal] .production-order-table td:first-child,
.dashboard-theme [data-stock-purchase-receipt-modal] .production-order-table td:first-child,
.dashboard-theme [data-stock-movement-modal] .production-order-table td:first-child,
.dashboard-theme .inventory-drilldown-table td:first-child {
  white-space: nowrap;
}

.dashboard-theme [data-stock-production-order-modal] .production-order-table td:nth-child(2),
.dashboard-theme [data-stock-purchase-receipt-modal] .production-order-table td:nth-child(2),
.dashboard-theme [data-stock-movement-modal] .production-order-table td:nth-child(2),
.dashboard-theme .inventory-drilldown-table td:nth-child(2),
.dashboard-theme .inventory-drilldown-table td:nth-child(3),
.dashboard-theme .inventory-drilldown-table td:nth-child(4) {
  line-height: 1.14;
}

.dashboard-theme [data-stock-production-order-modal] .production-order-material-empty,
.dashboard-theme [data-stock-purchase-receipt-modal] .production-order-material-empty,
.dashboard-theme [data-stock-movement-modal] .production-order-material-empty {
  margin-top: 2px;
}

@media (max-width: 980px) {
  .dashboard-theme [data-stock-production-order-modal] .production-order-detail-modal,
  .dashboard-theme [data-stock-purchase-receipt-modal] .production-order-detail-modal,
  .dashboard-theme [data-stock-movement-modal] .production-order-detail-modal,
  .dashboard-theme .inventory-drilldown-modal {
    width: min(100vw - 18px, 980px);
    max-height: min(90vh, calc(100vh - 18px));
    padding: 12px;
  }

  .dashboard-theme [data-stock-production-order-modal] .modal-summary-grid,
  .dashboard-theme [data-stock-purchase-receipt-modal] .modal-summary-grid,
  .dashboard-theme [data-stock-movement-modal] .modal-summary-grid,
  .dashboard-theme .inventory-drilldown-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme [data-stock-production-order-modal] .modal-table-wrap,
  .dashboard-theme [data-stock-purchase-receipt-modal] .modal-table-wrap,
  .dashboard-theme [data-stock-movement-modal] .modal-table-wrap,
  .dashboard-theme .inventory-drilldown-table-wrap {
    height: min(58vh, 560px);
  }
}

/* Stock v19 · acceso a trazabilidad desde remitos de la evaluación */
.dashboard-theme .inventory-purchase-traceability-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.dashboard-theme .inventory-purchase-traceability-link .ui-icon {
  width: 13px;
  height: 13px;
}

/* Ventas v21 · detalle compacto de pedido */
.dashboard-theme .sales-order-detail-modal-backdrop:not([hidden]) {
  z-index: 3250;
}

.dashboard-theme .sales-order-detail-modal-card {
  display: flex;
  flex-direction: column;
  width: min(1460px, calc(100vw - 28px));
  height: min(900px, calc(100vh - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  padding: 14px 16px;
  border-radius: 22px;
}

.dashboard-theme .sales-order-detail-heading {
  flex: 0 0 auto;
  gap: 12px;
  margin-bottom: 7px;
}

.dashboard-theme .sales-order-detail-heading .eyebrow {
  margin-bottom: 3px;
}

.dashboard-theme .sales-order-detail-heading h2 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.08;
}

.dashboard-theme .sales-order-detail-heading p {
  margin-top: 3px;
  font-size: .72rem;
  line-height: 1.25;
}

.dashboard-theme .sales-order-detail-heading .modal-close-button {
  width: 38px;
  height: 38px;
  font-size: 1.2rem;
}

.dashboard-theme .sales-order-detail-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-theme .sales-order-detail-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .56rem;
  font-weight: 900;
  white-space: nowrap;
}

.dashboard-theme .sales-order-detail-status.is-pending-preparation {
  color: #95541a;
  background: #fff0d8;
}

.dashboard-theme .sales-order-detail-status.is-pending-remittance {
  color: #245e78;
  background: #eaf5fb;
}

.dashboard-theme .sales-order-detail-status.is-pending-invoicing {
  color: #8a5a14;
  background: #fff3d8;
}

.dashboard-theme .sales-order-detail-status.is-clear {
  color: #40705c;
  background: #eaf4ef;
}

.dashboard-theme .sales-order-detail-state {
  display: grid;
  flex: 1 1 auto;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed #d8d1c5;
  border-radius: 12px;
  color: #707684;
  background: #fffdf8;
  font-size: .76rem;
  text-align: center;
}

.dashboard-theme .sales-order-detail-state[data-state="error"] {
  color: #9a3e34;
  border-color: rgba(154, 62, 52, .28);
  background: rgba(154, 62, 52, .05);
}

.dashboard-theme .sales-order-detail-state[hidden],
.dashboard-theme .sales-order-detail-content[hidden] {
  display: none !important;
}

.dashboard-theme .sales-order-detail-content {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 6px;
}

.dashboard-theme .sales-order-detail-summary {
  display: grid;
  grid-template-columns: minmax(200px, 1.35fr) minmax(145px, .85fr) repeat(5, minmax(112px, .68fr));
  gap: 6px;
}

.dashboard-theme .sales-order-detail-summary > span,
.dashboard-theme .sales-order-detail-contact-row > span,
.dashboard-theme .sales-order-detail-kpis > span {
  min-width: 0;
  border: 1px solid rgba(17, 24, 28, .08);
  border-radius: 10px;
  background: #fffdf9;
}

.dashboard-theme .sales-order-detail-summary > span {
  padding: 6px 8px;
}

.dashboard-theme .sales-order-detail-summary small,
.dashboard-theme .sales-order-detail-contact-row small,
.dashboard-theme .sales-order-detail-kpis small {
  display: block;
  margin-bottom: 2px;
  color: #7b8581;
  font-size: .50rem;
  font-weight: 950;
  letter-spacing: .045em;
  line-height: 1.1;
  text-transform: uppercase;
}

.dashboard-theme .sales-order-detail-summary strong,
.dashboard-theme .sales-order-detail-contact-row strong {
  display: block;
  overflow: hidden;
  color: #1b2422;
  font-size: .66rem;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .sales-order-detail-contact-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) minmax(170px, .8fr) minmax(150px, .7fr);
  gap: 6px;
}

.dashboard-theme .sales-order-detail-contact-row > span {
  padding: 5px 8px;
}

.dashboard-theme .sales-order-detail-kpis {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

.dashboard-theme .sales-order-detail-kpis > span {
  padding: 5px 7px;
}

.dashboard-theme .sales-order-detail-kpis strong {
  display: block;
  color: #18211f;
  font-size: .76rem;
  font-weight: 950;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .sales-order-detail-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid #ddd6ca;
  border-radius: 12px;
  background: #fffdf9;
  scrollbar-gutter: stable;
}

.dashboard-theme .sales-order-detail-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: .66rem;
}

.dashboard-theme .sales-order-detail-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 7px 6px;
  border-bottom: 1px solid #d9d2c7;
  color: #65706c;
  background: #f7f2e8;
  font-size: .52rem;
  font-weight: 950;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dashboard-theme .sales-order-detail-table td {
  padding: 6px 6px;
  border-bottom: 1px solid rgba(16, 18, 23, .055);
  color: #27302e;
  line-height: 1.15;
  vertical-align: middle;
}

.dashboard-theme .sales-order-detail-table tbody tr:hover td {
  background: rgba(245, 159, 47, .055);
}

.dashboard-theme .sales-order-detail-table tbody tr.is-do-not-deliver td {
  opacity: .72;
}

.dashboard-theme .sales-order-detail-table .number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-theme .sales-order-detail-table .sales-order-detail-article {
  width: 260px;
}

.dashboard-theme .sales-order-detail-table .sales-order-detail-article strong,
.dashboard-theme .sales-order-detail-table .sales-order-detail-article small {
  display: block;
}

.dashboard-theme .sales-order-detail-table .sales-order-detail-article strong {
  color: #18211f;
  font-size: .66rem;
  font-weight: 950;
}

.dashboard-theme .sales-order-detail-table .sales-order-detail-article small {
  margin-top: 1px;
  overflow: hidden;
  color: #79817e;
  font-size: .53rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .sales-order-detail-table .sales-order-detail-article em {
  display: inline-flex;
  margin-top: 2px;
  padding: 1px 5px;
  border-radius: 999px;
  color: #8e4b3d;
  background: #fbe9e4;
  font-size: .48rem;
  font-style: normal;
  font-weight: 900;
}

.dashboard-theme .sales-order-detail-table .sales-order-detail-deposit {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .sales-order-detail-table .sales-order-detail-pending {
  font-weight: 850;
}

.dashboard-theme .sales-order-detail-table th:nth-child(1) { width: 260px; }
.dashboard-theme .sales-order-detail-table th:nth-child(2) { width: 145px; }
.dashboard-theme .sales-order-detail-table th:nth-child(3) { width: 72px; }
.dashboard-theme .sales-order-detail-table th:nth-child(4) { width: 68px; }
.dashboard-theme .sales-order-detail-table th:nth-child(n+5) { width: 84px; }

body.dashboard-theme.widget-maximized > .sales-order-detail-modal-backdrop:not([hidden]) {
  z-index: 3300 !important;
  isolation: isolate;
  pointer-events: auto;
}

@media (max-width: 1180px) {
  .dashboard-theme .sales-order-detail-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-theme .sales-order-detail-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-theme .sales-order-detail-modal-card {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
    padding: 11px;
    border-radius: 16px;
  }

  .dashboard-theme .sales-order-detail-summary,
  .dashboard-theme .sales-order-detail-contact-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .sales-order-detail-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* Ventas v24 · modal de pedido proporcional al contenido + entrega/observación */
.dashboard-theme .sales-order-detail-modal-card {
  width: min(1280px, calc(100vw - 48px));
  height: auto;
  max-height: min(820px, calc(100vh - 40px));
  padding: 13px 15px;
}

.dashboard-theme .sales-order-detail-content {
  flex: 0 1 auto;
  min-height: 0;
  gap: 5px;
}

.dashboard-theme .sales-order-detail-summary {
  grid-template-columns: minmax(190px, 1.35fr) minmax(140px, .8fr) repeat(5, minmax(105px, .66fr));
  gap: 5px;
}

.dashboard-theme .sales-order-detail-summary > span,
.dashboard-theme .sales-order-detail-contact-row > span,
.dashboard-theme .sales-order-detail-delivery-row > span,
.dashboard-theme .sales-order-detail-observation,
.dashboard-theme .sales-order-detail-kpis > span {
  border: 1px solid rgba(17, 24, 28, .08);
  border-radius: 9px;
  background: #fffdf9;
}

.dashboard-theme .sales-order-detail-contact-row,
.dashboard-theme .sales-order-detail-delivery-row {
  display: grid;
  gap: 5px;
}

.dashboard-theme .sales-order-detail-contact-row {
  grid-template-columns: minmax(240px, 1.65fr) minmax(160px, .8fr) minmax(140px, .65fr);
}

.dashboard-theme .sales-order-detail-delivery-row {
  grid-template-columns: .55fr .9fr .85fr 1.1fr 1.1fr .8fr;
}

.dashboard-theme .sales-order-detail-contact-row > span,
.dashboard-theme .sales-order-detail-delivery-row > span {
  min-width: 0;
  padding: 5px 7px;
}

.dashboard-theme .sales-order-detail-delivery-row small,
.dashboard-theme .sales-order-detail-observation small {
  display: block;
  margin-bottom: 2px;
  color: #7b8581;
  font-size: .49rem;
  font-weight: 950;
  letter-spacing: .045em;
  line-height: 1.08;
  text-transform: uppercase;
}

.dashboard-theme .sales-order-detail-delivery-row strong {
  display: block;
  overflow: hidden;
  color: #1b2422;
  font-size: .64rem;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .sales-order-detail-observation {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 7px;
}

.dashboard-theme .sales-order-detail-observation small {
  margin: 0;
}

.dashboard-theme .sales-order-detail-observation strong {
  display: block;
  overflow: hidden;
  color: #27302e;
  font-size: .63rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .sales-order-detail-observation.is-empty {
  opacity: .72;
}

.dashboard-theme .sales-order-detail-kpis {
  gap: 4px;
}

.dashboard-theme .sales-order-detail-kpis > span {
  padding: 4px 6px;
}

.dashboard-theme .sales-order-detail-table-wrap {
  flex: 0 1 auto;
  min-height: 58px;
  max-height: min(52vh, 520px);
}

.dashboard-theme .sales-order-detail-table th {
  padding: 6px 5px;
}

.dashboard-theme .sales-order-detail-table td {
  padding: 5px 5px;
}

@media (max-width: 1180px) {
  .dashboard-theme .sales-order-detail-modal-card {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .dashboard-theme .sales-order-detail-delivery-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-theme .sales-order-detail-modal-card {
    width: calc(100vw - 16px);
    height: auto;
    max-height: calc(100vh - 16px);
  }

  .dashboard-theme .sales-order-detail-delivery-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .sales-order-detail-observation {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

/* Production main navigation */
.production-dashboard-shell {
  --production-ink: #152a27;
  --production-teal: #176b5b;
  --production-teal-soft: #dff3ed;
  --production-tomato: #d95032;
  --production-tomato-soft: #fff0e9;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.production-dashboard-shell > [data-production-dashboard-panel] {
  min-width: 0;
}

/* Production batch traceability */
.production-section-tabs {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  padding: 5px;
  border: 1px solid rgba(21, 42, 39, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 7px 22px rgba(21, 42, 39, 0.05);
}

.production-section-tab {
  min-height: 38px;
  padding: 0 17px;
  border: 0;
  border-radius: 10px;
  color: #596763;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.production-section-tab:hover,
.production-section-tab:focus-visible {
  color: var(--production-ink);
  background: rgba(23, 107, 91, 0.075);
}

.production-section-tab:focus-visible {
  outline: 3px solid rgba(23, 107, 91, 0.24);
  outline-offset: 2px;
}

.production-section-tab.is-active {
  color: #fff;
  background: var(--production-teal);
  box-shadow: 0 7px 16px rgba(23, 107, 91, 0.2);
}

.production-batch-traceability-panel {
  min-width: 0;
}

.production-batch-traceability-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid rgba(21, 42, 39, 0.1);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(26, 65, 58, 0.075);
}

.production-batch-traceability-heading,
.production-batch-traceability-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.production-batch-traceability-heading h2,
.production-batch-traceability-summary h3 {
  margin: 3px 0 4px;
  color: var(--production-ink);
  font-weight: 950;
  letter-spacing: -0.025em;
}

.production-batch-traceability-heading h2 { font-size: 1.3rem; }
.production-batch-traceability-summary h3 { font-size: 1.15rem; }

.production-batch-traceability-heading p,
.production-batch-traceability-summary p {
  max-width: 760px;
  margin: 0;
  color: #61706c;
  font-size: 13px;
  line-height: 1.45;
}

.production-batch-traceability-legend {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
  padding-top: 5px;
  color: #5f6d69;
  font-size: 11px;
  font-weight: 850;
}

.production-batch-traceability-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.production-batch-traceability-legend i {
  width: 10px;
  height: 10px;
  border: 2px solid var(--production-teal);
  border-radius: 50%;
  background: #fff;
}

.production-batch-traceability-legend i.is-confirmed { background: var(--production-teal); }
.production-batch-traceability-legend i.is-potential {
  border-color: var(--production-tomato);
  background: repeating-linear-gradient(135deg, rgba(217, 80, 50, 0.9) 0 2px, #fff 2px 4px);
}

.production-batch-traceability-search {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 0.9fr) minmax(190px, 0.75fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid rgba(21, 42, 39, 0.09);
  border-radius: 16px;
  background: #f7faf8;
}

.production-batch-traceability-search label {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.production-batch-traceability-search label > span {
  color: #4e5f5a;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.production-batch-traceability-search input,
.production-batch-traceability-search select {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid rgba(21, 42, 39, 0.18);
  border-radius: 10px;
  color: var(--production-ink);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.production-batch-traceability-search input:focus,
.production-batch-traceability-search select:focus {
  border-color: var(--production-teal);
  outline: 3px solid rgba(23, 107, 91, 0.14);
}

.production-batch-traceability-submit {
  min-height: 42px;
  white-space: nowrap;
}

.production-batch-traceability-submit[aria-busy="true"] {
  cursor: progress;
  opacity: .72;
}

.production-batch-traceability-state {
  display: grid;
  gap: 3px;
  margin-top: 14px;
  padding: 15px 17px;
  border: 1px dashed rgba(21, 42, 39, 0.16);
  border-radius: 14px;
  color: #55645f;
  background: #fbfcfb;
}

.production-batch-traceability-state strong {
  color: var(--production-ink);
  font-size: 13px;
}

.production-batch-traceability-state span { font-size: 12px; }
.production-batch-traceability-state[data-tone="loading"] { border-style: solid; border-color: rgba(23, 107, 91, .18); background: var(--production-teal-soft); }
.production-batch-traceability-state[data-tone="error"] { border-style: solid; border-color: rgba(217, 80, 50, .22); background: var(--production-tomato-soft); }

.production-batch-traceability-results {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(21, 42, 39, 0.09);
}

.production-batch-traceability-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.production-batch-traceability-chips span {
  padding: 6px 9px;
  border-radius: 999px;
  color: #38534c;
  background: #eef5f2;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.production-batch-traceability-warning {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(217, 80, 50, 0.2);
  border-radius: 11px;
  color: #7e3526;
  background: #fff5ef;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.production-batch-traceability-graph {
  display: flex;
  align-items: flex-start;
  gap: 38px;
  min-width: 100%;
  margin-top: 16px;
  padding: 2px 4px 14px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 107, 91, .35) transparent;
}

.production-batch-traceability-layer {
  position: relative;
  flex: 0 0 278px;
  min-width: 0;
}

.production-batch-traceability-layer:not(.is-last)::after {
  position: absolute;
  top: 49px;
  right: -29px;
  width: 20px;
  height: 10px;
  border-top: 2px solid rgba(23, 107, 91, 0.35);
  border-right: 2px solid rgba(23, 107, 91, 0.35);
  content: "";
  transform: rotate(45deg);
  transform-origin: center;
  pointer-events: none;
}

.production-batch-traceability-layer > header {
  display: grid;
  gap: 1px;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 0 2px;
}

.production-batch-traceability-layer > header span {
  color: #7d8b87;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .08em;
}

.production-batch-traceability-layer > header strong {
  color: var(--production-ink);
  font-size: 12px;
  font-weight: 950;
}

.production-batch-traceability-layer-nodes {
  display: grid;
  gap: 9px;
}

.production-batch-node {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(21, 42, 39, 0.12);
  border-left: 4px solid var(--production-teal);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 7px 22px rgba(21, 42, 39, 0.07);
}

.production-batch-node.is-order { border-left-color: #285d86; background: #fbfdff; }
.production-batch-node.is-source { border-left-color: #6c7a50; background: #fbfcf7; }
.production-batch-node.is-entry { border-left-color: #8a6b48; background: #fffdf9; }
.production-batch-node.is-root {
  border-color: rgba(23, 107, 91, 0.32);
  border-left-color: var(--production-teal);
  box-shadow: 0 10px 28px rgba(23, 107, 91, 0.14);
}

.production-batch-node.is-potential {
  border-top-style: dashed;
  border-right-style: dashed;
  border-bottom-style: dashed;
  border-left-color: var(--production-tomato);
  background: #fffaf7;
}

.production-batch-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.production-batch-node-kicker {
  overflow: hidden;
  color: #73817d;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-batch-node-certainty {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  color: #2d675a;
  background: var(--production-teal-soft);
  font-size: 9px;
  font-weight: 950;
}

.production-batch-node-certainty.is-potential {
  color: #983c28;
  background: var(--production-tomato-soft);
}

.production-batch-node-title {
  overflow-wrap: anywhere;
  color: var(--production-ink);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.15;
}

.production-batch-node-subtitle {
  display: -webkit-box;
  overflow: hidden;
  color: #596965;
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.production-batch-node-meta,
.production-batch-node-relations {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.production-batch-node-meta span,
.production-batch-node-relations span {
  padding: 4px 6px;
  border-radius: 7px;
  color: #4c605a;
  background: #f0f5f3;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.25;
}

.production-batch-node-relations span.is-potential {
  color: #8f3b29;
  background: #fff0e9;
}

.production-batch-node-details {
  color: #5e6d68;
  font-size: 10px;
}

.production-batch-node-details summary {
  width: fit-content;
  color: #45645c;
  font-weight: 900;
  cursor: pointer;
}

.production-batch-node-details p {
  margin: 5px 0 0;
  line-height: 1.4;
}

.production-batch-node-action,
.production-batch-layer-expand {
  justify-self: start;
  padding: 0;
  border: 0;
  color: var(--production-teal);
  background: transparent;
  font: inherit;
  font-size: 10px;
  font-weight: 950;
  cursor: pointer;
}

.production-batch-node-action:hover,
.production-batch-node-action:focus-visible,
.production-batch-layer-expand:hover,
.production-batch-layer-expand:focus-visible {
  color: #0d4f43;
  text-decoration: underline;
}

.production-batch-layer-expand {
  margin-top: 9px;
  padding: 7px 9px;
  border: 1px solid rgba(23, 107, 91, 0.18);
  border-radius: 9px;
  background: #f4f8f6;
  text-decoration: none;
}

@media (max-width: 980px) {
  .production-batch-traceability-search {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .production-batch-traceability-submit { width: 100%; }
}

@media (max-width: 700px) {
  .production-section-tabs { width: 100%; }
  .production-section-tab { flex: 1 1 0; }
  .production-batch-traceability-card { padding: 16px; }
  .production-batch-traceability-heading,
  .production-batch-traceability-summary { flex-direction: column; gap: 12px; }
  .production-batch-traceability-legend,
  .production-batch-traceability-chips { justify-content: flex-start; }
  .production-batch-traceability-search { grid-template-columns: 1fr; padding: 13px; }
  .production-batch-traceability-layer { flex-basis: min(82vw, 270px); }
  .production-batch-traceability-graph { gap: 32px; }
}


/* ========================================================================== */
/* Production traceability V2 — impact analysis + searchable article picker   */
/* ========================================================================== */

.dashboard-theme .production-batch-traceability-search {
  grid-template-columns: minmax(270px, 1.35fr) minmax(170px, .75fr) auto;
}

.dashboard-theme .production-batch-article-field {
  position: relative;
}

.dashboard-theme .production-batch-article-picker {
  position: relative;
  min-width: 0;
}

.dashboard-theme .production-batch-article-picker > input[type="search"] {
  padding-right: 34px;
}

.dashboard-theme .production-batch-article-picker::after {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #71807b;
  border-bottom: 2px solid #71807b;
  content: "";
  pointer-events: none;
  transform: translateY(-67%) rotate(45deg);
}

.dashboard-theme .production-batch-article-options {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 310px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid rgba(21, 42, 39, .16);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(21, 42, 39, .17);
}

.dashboard-theme .production-batch-article-option {
  display: grid;
  width: 100%;
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: #42524e;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-theme .production-batch-article-option:hover,
.dashboard-theme .production-batch-article-option.is-active,
.dashboard-theme .production-batch-article-option:focus-visible {
  background: #edf6f2;
  outline: none;
}

.dashboard-theme .production-batch-article-option strong {
  color: #152a27;
  font-size: 12px;
  font-weight: 950;
}

.dashboard-theme .production-batch-article-option span {
  overflow: hidden;
  color: #6f7c78;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .production-batch-article-option-empty {
  padding: 12px 10px;
  color: #7a8783;
  font-size: 11px;
  font-weight: 750;
}

.dashboard-theme .production-batch-impact-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-top: 9px;
  padding: 7px 0;
  border-top: 1px solid rgba(21, 42, 39, .07);
  border-bottom: 1px solid rgba(21, 42, 39, .07);
}

.dashboard-theme .production-batch-impact-summary article {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  min-height: 0;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid rgba(21, 42, 39, .1);
  border-radius: 0;
  background: transparent;
}

.dashboard-theme .production-batch-impact-summary article:first-child {
  padding-left: 0;
}

.dashboard-theme .production-batch-impact-summary article:last-child {
  border-right: 0;
}

.dashboard-theme .production-batch-impact-summary article span {
  color: #74817d;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .015em;
  line-height: 1.2;
  text-transform: none;
  white-space: nowrap;
}

.dashboard-theme .production-batch-impact-summary article strong {
  order: -1;
  color: #152a27;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
}

.dashboard-theme .production-batch-impact-summary article:nth-child(5) strong {
  color: #b3452f;
}

.dashboard-theme .production-batch-edge-detail {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(23, 107, 91, .17);
  border-left: 4px solid #176b5b;
  border-radius: 12px;
  background: #f2f8f5;
}

.dashboard-theme .production-batch-edge-detail > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-theme .production-batch-edge-detail strong {
  color: #152a27;
  font-size: 12px;
  font-weight: 950;
}

.dashboard-theme .production-batch-edge-detail p {
  margin: 0;
  color: #5b6a66;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.42;
}

.dashboard-theme .production-batch-edge-detail > button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(21, 42, 39, .12);
  border-radius: 50%;
  color: #52615d;
  background: #fff;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}


.dashboard-theme .production-batch-node {
  transition: opacity 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.dashboard-theme .production-batch-node:focus-visible {
  outline: 3px solid rgba(23, 107, 91, .2);
  outline-offset: 2px;
}




.dashboard-theme .production-batch-node-relations button {
  padding: 4px 6px;
  border: 0;
  border-radius: 7px;
  color: #4c605a;
  background: #f0f5f3;
  font: inherit;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.25;
  cursor: pointer;
}

.dashboard-theme .production-batch-node-relations button:hover,
.dashboard-theme .production-batch-node-relations button:focus-visible {
  color: #174f43;
  background: #e0f1eb;
  outline: none;
  text-decoration: underline;
}

.dashboard-theme .production-batch-node-relations button.is-potential {
  color: #8f3b29;
  background: #fff0e9;
}

.dashboard-theme .production-batch-node-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
}

.dashboard-theme .production-batch-graph-empty {
  width: min(520px, 100%);
  padding: 18px;
  border: 1px dashed rgba(21, 42, 39, .14);
  border-radius: 12px;
  color: #6f7c78;
  background: #fbfcfb;
  font-size: 12px;
  font-weight: 750;
}

@media (max-width: 980px) {
  .dashboard-theme .production-batch-traceability-search {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 700px) {
  .dashboard-theme .production-batch-impact-summary {
    gap: 6px 0;
  }

  .dashboard-theme .production-batch-impact-summary article {
    flex: 0 0 50%;
    padding: 2px 10px;
  }

  .dashboard-theme .production-batch-impact-summary article:nth-child(odd) {
    padding-left: 0;
  }

  .dashboard-theme .production-batch-impact-summary article:nth-child(even),
  .dashboard-theme .production-batch-impact-summary article:last-child {
    border-right: 0;
  }
}

/* ========================================================================== */
/* Production traceability V2.1 — compact nodes + batch picker                */
/* ========================================================================== */

.dashboard-theme .production-batch-batch-field,
.dashboard-theme .production-batch-batch-picker {
  position: relative;
  min-width: 0;
}

.dashboard-theme .production-batch-batch-field {
  display: grid;
  gap: 6px;
}

.dashboard-theme .production-batch-batch-field > label {
  display: block;
  min-width: 0;
}

.dashboard-theme .production-batch-batch-options {
  right: 0;
  left: 0;
}

.dashboard-theme .production-batch-batch-option {
  min-height: 34px;
  align-content: center;
}

.dashboard-theme .production-batch-traceability-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: #206e49;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.dashboard-theme .production-batch-traceability-submit:hover,
.dashboard-theme .production-batch-traceability-submit:focus-visible {
  background: #185a3b;
}

.dashboard-theme .production-batch-traceability-submit:focus-visible {
  outline: 3px solid rgb(42 128 86 / 22%);
  outline-offset: 2px;
}

.dashboard-theme .production-batch-traceability-submit .ui-icon {
  width: 14px;
  height: 14px;
}

.dashboard-theme .production-batch-traceability-heading {
  gap: 14px;
}

.dashboard-theme .production-batch-traceability-heading h2 {
  margin-top: 0;
}

.dashboard-theme .production-batch-traceability-summary {
  margin-top: 2px;
}

.dashboard-theme .production-batch-traceability-graph {
  position: relative;
  isolation: isolate;
  gap: 28px;
  margin-top: 10px;
  padding-bottom: 10px;
}

.dashboard-theme .production-batch-traceability-layer {
  z-index: 1;
  flex-basis: 232px;
}

.dashboard-theme .production-batch-traceability-layer:not(.is-last)::after {
  display: none;
}

.dashboard-theme .production-batch-traceability-edge-overlay {
  position: absolute;
  z-index: 0;
  inset: 0 auto auto 0;
  display: block;
  max-width: none;
  overflow: visible;
  pointer-events: none;
}

.dashboard-theme .production-batch-traceability-edge {
  fill: none;
  stroke: rgba(23, 107, 91, .48);
  stroke-width: 2;
  stroke-linecap: round;
  transition: opacity 160ms ease, stroke 160ms ease, stroke-width 160ms ease;
}

.dashboard-theme .production-batch-traceability-edge.is-potential {
  stroke: rgba(217, 80, 50, .62);
  stroke-dasharray: 5 4;
}

.dashboard-theme #production-traceability-arrow-confirmed path { fill: #176b5b; }
.dashboard-theme #production-traceability-arrow-potential path { fill: #d95032; }

.dashboard-theme .production-batch-traceability-edge.is-selected {
  opacity: 1;
  stroke-width: 3;
}

.dashboard-theme .production-batch-traceability-edge.is-dimmed {
  opacity: .08;
}

.dashboard-theme .production-batch-traceability-layer > header {
  min-height: 35px;
  margin-bottom: 6px;
}

.dashboard-theme .production-batch-traceability-layer-nodes {
  gap: 7px;
}

.dashboard-theme .production-batch-node {
  gap: 4px;
  padding: 9px 10px 9px 9px;
  border-radius: 10px;
  box-shadow: 0 5px 14px rgba(21, 42, 39, .055);
  cursor: pointer;
  transition: opacity 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.dashboard-theme .production-batch-node.is-connected {
  box-shadow: 0 0 0 1px rgba(23, 107, 91, .2), 0 8px 20px rgba(21, 42, 39, .09);
}

.dashboard-theme .production-batch-node.is-selected {
  border-color: rgba(23, 107, 91, .62);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, .16), 0 10px 24px rgba(21, 42, 39, .12);
}

.dashboard-theme .production-batch-node.is-dimmed {
  opacity: .28;
}

.dashboard-theme .production-batch-node-top {
  min-height: 23px;
  gap: 6px;
}

.dashboard-theme .production-batch-node-controls {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.dashboard-theme .production-batch-node-kicker {
  font-size: 8px;
}

.dashboard-theme .production-batch-node-certainty {
  padding: 2px 5px;
  font-size: 8px;
}

.dashboard-theme .production-batch-node-toggle {
  display: inline-grid;
  width: 23px;
  height: 23px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(21, 42, 39, .11);
  border-radius: 50%;
  color: #5c6b67;
  background: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.dashboard-theme .production-batch-node-toggle:hover,
.dashboard-theme .production-batch-node-toggle:focus-visible,
.dashboard-theme .production-batch-node-toggle[aria-expanded="true"] {
  color: #176b5b;
  border-color: rgba(23, 107, 91, .3);
  background: #edf6f2;
  outline: none;
}

.dashboard-theme .production-batch-node-toggle > span {
  transform: translateY(-1px);
}

.dashboard-theme .production-batch-node-title {
  font-size: 12px;
  line-height: 1.15;
}

.dashboard-theme .production-batch-node-order-link {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: #174e73;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  line-height: 1.15;
  text-align: left;
  cursor: pointer;
}

.dashboard-theme .production-batch-node-order-link:hover,
.dashboard-theme .production-batch-node-order-link:focus-visible {
  color: #0f628f;
  text-decoration: underline;
  outline: none;
}

.dashboard-theme .production-batch-node-subtitle {
  display: block;
  overflow: hidden;
  font-size: 9.5px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-line-clamp: unset;
}

.dashboard-theme .production-batch-node-meta-compact {
  flex-wrap: nowrap;
  gap: 4px;
  overflow: hidden;
}

.dashboard-theme .production-batch-node-meta-compact span {
  flex: 0 1 auto;
  min-width: 0;
  padding: 2px 5px;
  overflow: hidden;
  font-size: 8px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.dashboard-theme .production-batch-node.is-expanded {
  gap: 6px;
}

.dashboard-theme .production-batch-node-inline-detail {
  display: grid;
  gap: 6px;
  margin-top: 2px;
  padding-top: 7px;
  border-top: 1px solid rgba(21, 42, 39, .08);
}

.dashboard-theme .production-batch-node-inline-detail[hidden] {
  display: none;
}

.dashboard-theme .production-batch-node-inline-detail .production-batch-node-meta {
  gap: 4px;
}

.dashboard-theme .production-batch-node-inline-detail .production-batch-node-meta span {
  padding: 2px 5px;
  font-size: 8px;
}

.dashboard-theme .production-batch-node-inline-detail .production-batch-node-relations {
  gap: 4px;
}

.dashboard-theme .production-batch-node-inline-actions {
  display: flex;
  align-items: center;
  min-height: 18px;
}

@media (max-width: 700px) {
  .dashboard-theme .production-batch-traceability-search {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .production-batch-traceability-layer {
    flex-basis: min(78vw, 224px);
  }
}

@media (max-width: 980px) {
  .dashboard-theme .production-batch-traceability-submit {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-theme .production-batch-node,
  .dashboard-theme .production-batch-traceability-edge {
    transition: none;
  }
}

/* Production traceability V2.3 — keep search controls on one desktop row */
@media (min-width: 981px) {
  .dashboard-theme .production-batch-traceability-search {
    grid-template-columns: minmax(190px, .75fr) minmax(320px, 1.35fr) minmax(170px, .72fr) max-content;
    align-items: end;
  }

  .dashboard-theme .production-traceability-search-mode {
    grid-column: 1;
  }

  .dashboard-theme .production-batch-article-field {
    grid-column: 2;
  }

  .dashboard-theme .production-batch-batch-field {
    grid-column: 3;
  }

  .dashboard-theme .production-traceability-order-field {
    grid-column: 2 / span 2;
  }

  .dashboard-theme .production-batch-traceability-submit {
    grid-column: 4;
    width: auto;
    min-width: 190px;
    padding-inline: 18px;
  }
}

/* Production OP modal -> lot traceability
   Reuse the same trigger + contextual menu language used by Ventas/Compras. */
.dashboard-theme .production-order-lot-menu-button {
  vertical-align: middle;
}

/* .modal-summary-grid styles every descendant span as a summary card. Reset
   the two inline spans inside the shared action trigger so they keep the exact
   reference/chevron treatment used by Ventas and Compras. */
.dashboard-theme .modal-summary-grid .production-order-lot-menu-button > span {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  overflow-wrap: normal;
}

.dashboard-theme .modal-summary-grid .production-order-lot-menu-button > .customer-account-detail-reference-chevron {
  flex: 0 0 auto;
  color: #b56b08;
  font-size: .9rem;
  font-weight: 950;
  line-height: 1;
}

.production-order-lot-action-menu {
  z-index: 4100;
}

.dashboard-theme .production-traceability-lot-backdrop {
  z-index: 180;
  padding: 16px;
}

.dashboard-theme .production-traceability-lot-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1500px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
  padding: 18px;
}

.dashboard-theme .production-traceability-lot-modal-heading {
  margin-bottom: 10px;
}

.dashboard-theme .production-traceability-lot-modal-heading h2 {
  margin-bottom: 3px;
}

.dashboard-theme .production-traceability-lot-modal-host {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.dashboard-theme .production-traceability-lot-modal-host > .production-batch-traceability-panel {
  display: block;
  min-width: 0;
}

.dashboard-theme .production-traceability-lot-modal-host .production-batch-traceability-card {
  padding: 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.dashboard-theme .production-traceability-lot-modal-host .production-batch-traceability-heading {
  display: none;
}

.dashboard-theme .production-traceability-lot-modal-host .production-batch-traceability-search {
  margin-top: 2px;
}

.dashboard-theme .production-traceability-lot-modal-host .production-batch-traceability-results {
  margin-top: 14px;
  padding-top: 14px;
}

@media (max-width: 900px) {
  .dashboard-theme .production-traceability-lot-backdrop {
    padding: 8px;
  }

  .dashboard-theme .production-traceability-lot-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 12px;
    border-radius: 18px;
  }

  .dashboard-theme .production-traceability-lot-modal-host .production-batch-traceability-search {
    grid-template-columns: 1fr;
  }
}

/* ========================================================================== */
/* Delidips refinement vResponsive — scalable navigation + responsive shell   */
/* ========================================================================== */

.dashboard-theme {
  --adaptive-sidebar-compact-width: 76px;
  --adaptive-sidebar-expanded-width: 218px;
  --adaptive-sidebar-left: 18px;
  --adaptive-sidebar-gap: 18px;
}

.dashboard-theme .dashboard-mobile-nav-bar,
.dashboard-theme .dashboard-sidebar-mobile-close,
.dashboard-theme .dashboard-sidebar-backdrop {
  display: none;
}

/* The navigation area is the only vertically scrollable part of the rail.
   Brand and Settings remain available even when more modules are added. */
.dashboard-theme .dashboard-sidebar {
  overflow: visible;
}

.dashboard-theme .dashboard-sidebar .tab-strip {
  min-height: 0;
  overscroll-behavior: contain;
}

@media (min-width: 768px) {
  .dashboard-theme .app-shell,
  .dashboard-theme.sidebar-expanded .app-shell,
  .dashboard-theme.sidebar-collapsed .app-shell {
    padding: 18px 20px 36px calc(var(--adaptive-sidebar-left) + var(--adaptive-sidebar-compact-width) + var(--adaptive-sidebar-gap));
    transition: padding-left 180ms ease;
  }

  .dashboard-theme .dashboard-sidebar,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar {
    position: fixed;
    z-index: 1200;
    top: 18px;
    bottom: 18px;
    left: var(--adaptive-sidebar-left);
    display: flex;
    width: var(--adaptive-sidebar-compact-width);
    height: auto;
    margin: 0;
    padding: 12px 8px 10px;
    align-items: stretch;
    overflow: visible;
    border-radius: 24px;
    background: #11181c;
    box-shadow: 0 12px 34px rgba(13, 30, 27, .12);
    transition: width 180ms ease, border-radius 180ms ease, box-shadow 180ms ease;
  }

  .dashboard-theme .dashboard-sidebar-header,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-header,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .dashboard-theme .dashboard-sidebar-brand,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    display: grid;
    width: 52px;
    height: 50px;
    margin: 0 0 10px;
    padding: 5px;
    place-items: center;
    border-radius: 15px;
    background: #faf7ef;
    overflow: hidden;
  }

  .dashboard-theme .dashboard-brand-mark,
  .dashboard-theme.sidebar-expanded .dashboard-brand-mark,
  .dashboard-theme.sidebar-collapsed .dashboard-brand-mark {
    display: block;
    width: auto;
    height: auto;
    overflow: visible;
    color: #11181c;
    background: transparent;
    opacity: 1;
    font-size: .80rem;
    font-weight: 950;
    line-height: 1;
  }

  .dashboard-theme .dashboard-brand-name,
  .dashboard-theme.sidebar-expanded .dashboard-brand-name,
  .dashboard-theme.sidebar-collapsed .dashboard-brand-name {
    display: none;
  }

  .dashboard-theme .dashboard-sidebar .tab-strip,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .tab-strip,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .tab-strip {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-height: 0;
    padding: 0 1px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.22) transparent;
  }

  .dashboard-theme .dashboard-sidebar .tab-strip::-webkit-scrollbar {
    display: block;
    width: 4px;
  }

  .dashboard-theme .dashboard-sidebar .tab-strip::-webkit-scrollbar-track {
    background: transparent;
  }

  .dashboard-theme .dashboard-sidebar .tab-strip::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255,255,255,.20);
  }

  .dashboard-theme .dashboard-nav-section,
  .dashboard-theme.sidebar-expanded .dashboard-nav-section,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
  }

  .dashboard-theme .dashboard-nav-section + .dashboard-nav-section,
  .dashboard-theme.sidebar-expanded .dashboard-nav-section + .dashboard-nav-section,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-section + .dashboard-nav-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,.16);
  }

  .dashboard-theme .dashboard-nav-section-title,
  .dashboard-theme.sidebar-expanded .dashboard-nav-section-title,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-section-title {
    display: none;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    min-height: 42px;
    padding: 6px 4px;
    border: 0;
    border-radius: 13px;
    color: rgba(250,247,239,.78);
    background: transparent;
    font-size: .60rem;
    line-height: 1.12;
    text-align: center;
    white-space: normal;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button .ui-icon,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button .ui-icon,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button .ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button > span:last-child,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button > span:last-child,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button > span:last-child {
    display: none;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button:hover,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button:hover,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button.is-active,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button.is-active,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button.is-active {
    color: #11181c;
    background: #faf7ef;
  }

  .dashboard-theme .dashboard-sidebar-foot,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-foot {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    min-height: 44px;
    margin-top: 8px;
    padding: 8px 4px 2px;
    border-top: 1px solid rgba(255,255,255,.18);
    font-size: .60rem;
  }

  .dashboard-theme .dashboard-sidebar-foot > span:last-child,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot > span:last-child,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-foot > span:last-child {
    display: none;
  }

  .dashboard-theme .dashboard-sidebar-toggle,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-toggle,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-toggle {
    display: none !important;
  }
}

/* Wide desktop: the same rail can expand without changing module order. */
@media (min-width: 1180px) {
  .dashboard-theme .dashboard-sidebar-toggle,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-toggle,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-toggle {
    position: absolute;
    z-index: 5;
    top: 12px;
    right: -14px;
    display: grid !important;
    width: 28px;
    height: 28px;
    padding: 0;
    place-items: center;
    border: 1px solid #d8d0c3;
    border-radius: 999px;
    color: #11181c;
    background: #fbf8f1;
    box-shadow: 0 5px 18px rgba(17,24,28,.16);
    cursor: pointer;
  }

  .dashboard-theme .dashboard-sidebar-toggle-glyph {
    position: relative;
    display: block;
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 180ms ease;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-toggle-glyph {
    transform: rotate(225deg);
  }

  .dashboard-theme.sidebar-expanded .app-shell {
    padding-left: calc(var(--adaptive-sidebar-left) + var(--adaptive-sidebar-expanded-width) + var(--adaptive-sidebar-gap));
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar {
    width: var(--adaptive-sidebar-expanded-width);
    padding-right: 10px;
    padding-left: 10px;
    border-radius: 24px;
    box-shadow: 0 16px 42px rgba(13,30,27,.14);
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-header {
    justify-content: flex-start;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    width: 100%;
    height: 50px;
    padding: 6px 10px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-brand-mark {
    display: grid;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    place-items: center;
    border-radius: 9px;
    color: #faf7ef;
    background: #11181c;
    font-size: .68rem;
  }

  .dashboard-theme.sidebar-expanded .dashboard-brand-name {
    display: block;
    min-width: 0;
    color: #11181c;
    font-size: .80rem;
    font-weight: 950;
    line-height: 1;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-section-title {
    display: block;
    padding: 5px 10px 4px;
    color: rgba(250,247,239,.48);
    font-size: .50rem;
    font-weight: 900;
    line-height: 1.1;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .09em;
    white-space: nowrap;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    min-height: 40px;
    padding: 7px 10px;
    border-radius: 12px;
    font-size: .64rem;
    text-align: left;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button > span:last-child {
    display: block;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    min-height: 44px;
    padding: 9px 10px 2px;
    font-size: .63rem;
    text-align: left;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot > span:last-child {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Tablet: always use the icon rail so the dashboard keeps enough horizontal
   room for two-column widget layouts. */
@media (min-width: 768px) and (max-width: 1179px) {
  .dashboard-theme .app-shell,
  .dashboard-theme.sidebar-expanded .app-shell,
  .dashboard-theme.sidebar-collapsed .app-shell {
    padding-left: 106px;
  }

  .dashboard-theme .dashboard-sidebar,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar {
    left: 14px;
    width: 70px;
    padding-right: 7px;
    padding-left: 7px;
  }
}

/* Phone: navigation becomes an off-canvas drawer and a compact fixed header. */
@media (max-width: 767px) {
  .dashboard-theme {
    overflow-x: hidden;
  }

  .dashboard-theme .app-shell,
  .dashboard-theme.sidebar-expanded .app-shell,
  .dashboard-theme.sidebar-collapsed .app-shell {
    width: 100%;
    padding: 78px 10px 26px;
  }

  .dashboard-theme .content-wrap {
    width: 100%;
    min-height: 0;
  }

  .dashboard-theme .dashboard-mobile-nav-bar {
    position: fixed;
    z-index: 1150;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    min-height: 56px;
    padding: 7px 10px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid rgba(216,208,195,.92);
    border-radius: 18px;
    background: rgba(250,247,239,.96);
    box-shadow: 0 10px 28px rgba(17,24,28,.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .dashboard-theme .dashboard-mobile-menu-button {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: #11181c;
  }

  .dashboard-theme .dashboard-menu-glyph {
    display: grid;
    gap: 4px;
    width: 17px;
  }

  .dashboard-theme .dashboard-menu-glyph i {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .dashboard-theme .dashboard-mobile-nav-context {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    gap: 9px;
  }

  .dashboard-theme .dashboard-mobile-brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 10px;
    color: #11181c;
    background: #fff;
    border: 1px solid #e0d8cb;
    font-size: .66rem;
    font-weight: 950;
  }

  .dashboard-theme .dashboard-mobile-nav-copy {
    display: grid;
    min-width: 0;
    gap: 1px;
  }

  .dashboard-theme .dashboard-mobile-nav-copy small {
    color: #8a7d6d;
    font-size: .48rem;
    font-weight: 850;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: .08em;
  }

  .dashboard-theme .dashboard-mobile-nav-copy strong {
    overflow: hidden;
    color: #11181c;
    font-size: .78rem;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-theme .dashboard-sidebar,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar {
    position: fixed;
    z-index: 1500;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: min(86vw, 320px);
    height: 100dvh;
    margin: 0;
    padding: 14px 12px 12px;
    align-items: stretch;
    overflow: visible;
    border-radius: 0 24px 24px 0;
    background: #11181c;
    box-shadow: 20px 0 55px rgba(8,18,18,.24);
    transform: translateX(calc(-100% - 28px));
    transition: transform 220ms ease;
  }

  .dashboard-theme.sidebar-mobile-open .dashboard-sidebar {
    transform: translateX(0);
  }

  .dashboard-theme .dashboard-sidebar-header,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-header,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .dashboard-theme .dashboard-sidebar-brand,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    display: flex;
    width: auto;
    height: 48px;
    margin: 0 0 10px;
    padding: 6px 10px;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    border-radius: 14px;
    background: #faf7ef;
    overflow: hidden;
  }

  .dashboard-theme .dashboard-brand-mark,
  .dashboard-theme.sidebar-expanded .dashboard-brand-mark,
  .dashboard-theme.sidebar-collapsed .dashboard-brand-mark {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border-radius: 8px;
    color: #faf7ef;
    background: #11181c;
    font-size: .65rem;
    opacity: 1;
  }

  .dashboard-theme .dashboard-brand-name,
  .dashboard-theme.sidebar-expanded .dashboard-brand-name,
  .dashboard-theme.sidebar-collapsed .dashboard-brand-name {
    display: block;
    color: #11181c;
    font-size: .78rem;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .dashboard-theme .dashboard-sidebar-toggle,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-toggle,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-toggle {
    display: none !important;
  }

  .dashboard-theme .dashboard-sidebar-mobile-close {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    margin: 0 0 10px 8px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 12px;
    color: #faf7ef;
    background: rgba(255,255,255,.06);
    font-size: 1.25rem;
    line-height: 1;
  }

  .dashboard-theme .dashboard-sidebar .tab-strip,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .tab-strip,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .tab-strip {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-height: 0;
    padding: 1px 3px 4px 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.24) transparent;
  }

  .dashboard-theme .dashboard-sidebar .tab-strip::-webkit-scrollbar {
    display: block;
    width: 4px;
  }

  .dashboard-theme .dashboard-sidebar .tab-strip::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255,255,255,.22);
  }

  .dashboard-theme .dashboard-nav-section,
  .dashboard-theme.sidebar-expanded .dashboard-nav-section,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
  }

  .dashboard-theme .dashboard-nav-section + .dashboard-nav-section,
  .dashboard-theme.sidebar-expanded .dashboard-nav-section + .dashboard-nav-section,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-section + .dashboard-nav-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.15);
  }

  .dashboard-theme .dashboard-nav-section-title,
  .dashboard-theme.sidebar-expanded .dashboard-nav-section-title,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-section-title {
    display: block;
    padding: 5px 9px 4px;
    color: rgba(250,247,239,.46);
    font-size: .50rem;
    font-weight: 900;
    line-height: 1.1;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .09em;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 12px;
    color: rgba(250,247,239,.82);
    background: transparent;
    font-size: .66rem;
    line-height: 1.15;
    text-align: left;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button .ui-icon,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button .ui-icon,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button .ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-button > span:last-child,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button > span:last-child,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button > span:last-child {
    display: block;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-theme .dashboard-sidebar-foot,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-foot {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    margin-top: 8px;
    padding: 9px 10px 2px;
    border-top: 1px solid rgba(255,255,255,.17);
    font-size: .66rem;
    text-align: left;
  }

  .dashboard-theme .dashboard-sidebar-foot > span:last-child,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot > span:last-child,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-foot > span:last-child {
    display: block;
  }

  .dashboard-theme .dashboard-sidebar-backdrop {
    position: fixed;
    z-index: 1450;
    inset: 0;
    display: block;
    width: 100vw;
    height: 100dvh;
    padding: 0;
    border: 0;
    background: rgba(10,20,20,.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  .dashboard-theme.sidebar-mobile-open .dashboard-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .dashboard-theme.sidebar-mobile-open {
    overflow: hidden;
  }

  .dashboard-theme .dashboard-hero {
    min-height: 0;
    margin-bottom: 10px;
    padding: 16px 14px;
    border-radius: 18px;
  }

  .dashboard-theme .dashboard-hero h1 {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .dashboard-theme .filter-panel {
    margin-bottom: 10px;
  }

  .dashboard-theme .filter-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 52px;
    padding: 8px 10px;
    border-radius: 16px;
  }

  .dashboard-theme .filter-summary-heading {
    min-width: 0;
  }

  .dashboard-theme .filter-summary-heading .eyebrow {
    font-size: .56rem;
  }

  .dashboard-theme .filter-summary-chips {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    gap: 5px;
  }

  .dashboard-theme .filter-summary-chips span {
    min-height: 29px;
    padding: 4px 8px;
    font-size: .60rem;
  }

  .dashboard-theme .filter-toggle-text {
    min-width: 78px;
    min-height: 30px;
    padding: 5px 10px;
    font-size: .58rem;
  }

  .dashboard-theme .filter-body {
    max-height: none;
    margin-top: 7px;
    padding: 12px;
    border-radius: 16px;
    overflow-x: hidden;
  }

  .dashboard-theme .production-compact-grid,
  .dashboard-theme .purchase-compact-grid,
  .dashboard-theme .delivery-compact-grid,
  .dashboard-theme .summary-compact-grid,
  .dashboard-theme .sales-panel-grid,
  .dashboard-theme .sales-products-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .dashboard-theme .production-compact-widget,
  .dashboard-theme .purchase-compact-widget,
  .dashboard-theme .delivery-compact-widget,
  .dashboard-theme .summary-compact-widget,
  .dashboard-theme .sales-compact-widget {
    width: 100%;
    min-width: 0;
    height: auto;
    max-width: 100%;
  }

  .dashboard-theme .sales-section-tabs {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .dashboard-theme .sales-section-tabs::-webkit-scrollbar {
    display: none;
  }

  .dashboard-theme .widget-modal-backdrop {
    padding: 8px;
  }

  .dashboard-theme .widget-modal-backdrop > .is-widget-maximized {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 18px !important;
  }

  .dashboard-theme .production-order-detail-modal,
  .dashboard-theme .sales-order-detail-modal-card {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 18px !important;
  }

  .dashboard-theme .modal-table-wrap,
  .dashboard-theme .table-responsive,
  .dashboard-theme [class*="table-wrap"] {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 430px) {
  .dashboard-theme .app-shell,
  .dashboard-theme.sidebar-expanded .app-shell,
  .dashboard-theme.sidebar-collapsed .app-shell {
    padding-right: 8px;
    padding-left: 8px;
  }

  .dashboard-theme .dashboard-mobile-nav-bar {
    right: 8px;
    left: 8px;
  }

  .dashboard-theme .dashboard-mobile-brand-mark {
    display: none;
  }

  .dashboard-theme .production-mini-row {
    grid-template-columns: minmax(78px, .85fr) minmax(86px, 1.25fr) auto;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-theme .dashboard-sidebar,
  .dashboard-theme .app-shell,
  .dashboard-theme .dashboard-sidebar-backdrop,
  .dashboard-theme .dashboard-sidebar-toggle-glyph {
    transition: none !important;
  }
}

/* Configuration is a button with an extra class; keep it aligned with the
   adaptive footer instead of the legacy icon-above-label rule. */
@media (min-width: 768px) {
  .dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-height: 44px;
    padding: 8px 4px 2px;
    border-radius: 0 0 13px 13px;
    font-size: .60rem;
  }
}

@media (min-width: 1180px) {
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 44px;
    padding: 9px 10px 2px;
    border-radius: 0 0 12px 12px;
    font-size: .63rem;
    text-align: left;
  }
}

@media (max-width: 767px) {
  .dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 46px;
    padding: 9px 10px 2px;
    border-radius: 0 0 12px 12px;
    font-size: .66rem;
    text-align: left;
  }
}

/* ========================================================================== */
/* Responsive navigation — sidebar brand refinement                           */
/* ========================================================================== */
/* Keep the Delidips brand as a compact vertical lockup. In the expanded rail
   it must not stretch across the full sidebar because that distorts the logo
   and can clip the brand name. */
@media (min-width: 1180px) {
  .dashboard-theme.sidebar-expanded .dashboard-sidebar-header {
    justify-content: center;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 72px;
    height: 62px;
    margin: 0 auto 10px;
    padding: 6px 5px;
    border-radius: 17px;
    background: #faf7ef;
    overflow: hidden;
  }

  .dashboard-theme.sidebar-expanded .dashboard-brand-mark {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    place-items: center;
    border-radius: 8px;
    color: #faf7ef;
    background: #11181c;
    font-size: .61rem;
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0;
  }

  .dashboard-theme.sidebar-expanded .dashboard-brand-name {
    display: block;
    max-width: 62px;
    color: #11181c;
    font-size: .48rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .055em;
    white-space: nowrap;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-toggle {
    top: 17px;
  }
}

/* ========================================================================== */
/* Responsive tables — widget and maximized views                             */
/* ========================================================================== */
/* Tables retain their normal desktop/tablet presentation. On phone widths the
   same rows become compact label/value cards, so columns never disappear off
   the right edge. The transformation also applies after a widget is maximized
   because the original table remains in the DOM. */
.dashboard-theme .responsive-stack-table {
  max-width: 100%;
}

@media (max-width: 767px) {
  .dashboard-theme .chart-card,
  .dashboard-theme .production-panel,
  .dashboard-theme .modal-card,
  .dashboard-theme .widget-modal-backdrop > .is-widget-maximized,
  .dashboard-theme [data-widget-managed] {
    min-width: 0;
  }

  .dashboard-theme .ranking-table-wrap,
  .dashboard-theme .sales-orders-table-wrap,
  .dashboard-theme .sales-order-portfolio-table-wrap,
  .dashboard-theme .sales-order-detail-table-wrap,
  .dashboard-theme .sales-order-day-table-wrap,
  .dashboard-theme .purchase-supplier-orders-table-wrap,
  .dashboard-theme .modal-table-wrap,
  .dashboard-theme [class*="table-wrap"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: visible;
  }

  .dashboard-theme table.responsive-stack-table {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
  }

  .dashboard-theme table.responsive-stack-table > thead {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .dashboard-theme table.responsive-stack-table > tbody {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 8px;
  }

  .dashboard-theme table.responsive-stack-table > tbody > tr {
    display: grid;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(16, 18, 23, .09);
    border-radius: 14px;
    background: rgba(255, 255, 255, .56);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
  }

  .dashboard-theme table.responsive-stack-table > tbody > tr[hidden] {
    display: none !important;
  }

  .dashboard-theme table.responsive-stack-table > tbody > tr > td {
    display: grid;
    grid-template-columns: minmax(78px, 38%) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 30px;
    padding: 6px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(16, 18, 23, .055) !important;
    white-space: normal !important;
    overflow: visible !important;
    text-align: left !important;
    vertical-align: top;
  }

  .dashboard-theme table.responsive-stack-table > tbody > tr > td:last-child {
    border-bottom: 0 !important;
  }

  .dashboard-theme table.responsive-stack-table > tbody > tr > td::before {
    content: attr(data-column-label);
    min-width: 0;
    color: #76807c;
    font-size: .54rem;
    font-weight: 900;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: .045em;
  }

  .dashboard-theme table.responsive-stack-table > tbody > tr > td[colspan] {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-theme table.responsive-stack-table > tbody > tr > td[colspan]::before {
    display: none;
  }

  .dashboard-theme table.responsive-stack-table td > *,
  .dashboard-theme table.responsive-stack-table td a,
  .dashboard-theme table.responsive-stack-table td button,
  .dashboard-theme table.responsive-stack-table td span,
  .dashboard-theme table.responsive-stack-table td strong,
  .dashboard-theme table.responsive-stack-table td small {
    max-width: 100%;
    min-width: 0;
  }

  .dashboard-theme table.responsive-stack-table td a,
  .dashboard-theme table.responsive-stack-table td span,
  .dashboard-theme table.responsive-stack-table td strong,
  .dashboard-theme table.responsive-stack-table td small {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .dashboard-theme table.responsive-stack-table td .number-cell,
  .dashboard-theme table.responsive-stack-table td.number-cell {
    text-align: left !important;
  }

  .dashboard-theme .is-widget-maximized table.responsive-stack-table,
  .dashboard-theme .widget-modal-backdrop table.responsive-stack-table {
    width: 100% !important;
    max-width: 100% !important;
  }

  .dashboard-theme .is-widget-maximized .ranking-table-wrap,
  .dashboard-theme .is-widget-maximized [class*="table-wrap"] {
    flex: 1 1 auto;
    max-height: none;
    overflow-x: visible;
    overflow-y: auto;
  }
}

@media (max-width: 430px) {
  .dashboard-theme table.responsive-stack-table > tbody > tr > td {
    grid-template-columns: minmax(72px, 36%) minmax(0, 1fr);
    gap: 8px;
  }
}

/* ========================================================================== */
/* Mobile overlays — keep maximized widgets/modals above fixed navigation     */
/* ========================================================================== */
/* The mobile module bar is fixed at z-index 1150. Widget maximization used a
   legacy z-index (70), so its heading controls could sit physically behind the
   navigation bar. On phones every modal surface must own the viewport while it
   is open; the off-canvas navigation remains below the modal layer. */
@media (max-width: 767px) {
  .dashboard-theme .widget-modal-backdrop {
    z-index: 1800;
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .dashboard-theme .modal-backdrop:not([hidden]) {
    z-index: 1800;
  }

  .dashboard-theme .widget-modal-backdrop > .is-widget-maximized {
    position: relative !important;
    z-index: 1 !important;
  }

  .dashboard-theme .widget-modal-backdrop > .is-widget-maximized > .card-heading,
  .dashboard-theme .widget-modal-backdrop > .is-widget-maximized > [data-widget-heading] {
    position: sticky;
    top: 0;
    z-index: 12;
  }
}

/* ========================================================================== */
/* Responsive widgets v2 — mobile modal stacking + chart/layout corrections   */
/* ========================================================================== */
/* The mobile navigation sits at z-index 1150. Older widget-modal rules still
   had an !important z-index of 1000, so the navigation could cover restore/
   minimize controls. Promote the widget layer without overtaking nested
   detail modals (3000+), and make the modal itself the viewport owner. */
@media (max-width: 767px) {
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop {
    z-index: 2000 !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left)) !important;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* Generic application dialogs opened on mobile must also sit over the
     fixed module bar. Nested dialogs retain their more specific 3000+ layer. */
  body.dashboard-theme > .modal-backdrop:not([hidden]) {
    z-index: 2300 !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .is-widget-maximized {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 16px) !important;
    margin-block: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border-radius: 18px !important;
  }

  /* Keep restore/minimize controls inside the visible modal viewport even
     while the widget body scrolls. */
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .is-widget-maximized > .card-heading,
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .is-widget-maximized > [data-widget-heading] {
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
    flex: 0 0 auto;
    background: linear-gradient(180deg, #fbf8f1 0%, #fbf8f1 88%, rgba(251, 248, 241, 0) 100%) !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .is-widget-maximized .widget-control-group {
    z-index: 40 !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .is-widget-maximized canvas {
    display: block;
    max-width: 100% !important;
  }

  /* Ventas · Reporte de pedidos. The desktop 420px minimum chart height is
     too aggressive on a phone; keep a useful landscape plot without forcing
     the heading underneath the navigation. */
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .sales-orders-history-card.is-widget-maximized {
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 16px) !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .sales-orders-history-card.is-widget-maximized .sales-orders-chart-wrap {
    flex: 0 0 auto !important;
    width: 100%;
    height: clamp(220px, 42dvh, 340px) !important;
    min-height: clamp(220px, 42dvh, 340px) !important;
  }

  /* Ventas · Estado de pedidos. The expanded desktop rule forces two columns
     and a 380px doughnut. On a phone that pushes the chart outside the card.
     Stack the chart and legend and bound the doughnut to the card width. */
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .sales-order-status-card.is-widget-maximized {
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 16px) !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .sales-order-status-card.is-widget-maximized .sales-order-status-content {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    justify-items: stretch;
    gap: 8px !important;
    min-width: 0;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .sales-order-status-card.is-widget-maximized .sales-order-status-chart-wrap {
    flex: 0 0 auto !important;
    width: min(210px, 58vw) !important;
    height: min(210px, 58vw) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .sales-order-status-card.is-widget-maximized .sales-order-status-legend {
    width: 100%;
    min-width: 0;
    gap: 3px;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .sales-order-status-card.is-widget-maximized .sales-order-status-row {
    padding-block: 5px;
  }

  /* Producción · Cobertura por artículo. The long list owns the remaining
     height so the card header and restore button never leave the viewport. */
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .production-coverage-widget.is-widget-maximized {
    height: calc(100dvh - 16px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 16px) !important;
    overflow: hidden !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .production-coverage-widget.is-widget-maximized .production-coverage-summary {
    justify-content: flex-start !important;
    flex-wrap: wrap;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .production-coverage-widget.is-widget-maximized .production-coverage-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  /* Cuentas corrientes · rankings and charts. Use the full available phone
     height, but keep scrolling inside the widget content rather than behind
     the fixed navigation. */
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-debtors-card.is-widget-maximized,
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized,
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-chart-card.supplier-account-trend-card.is-widget-maximized:not(.customer-account-collections-card),
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized,
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-chart-card.supplier-account-dpo-card.is-widget-maximized {
    width: 100% !important;
    max-width: 100% !important;
    height: calc(100dvh - 16px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 16px) !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-debtors-card.is-widget-maximized {
    overflow: hidden !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-debtors-card.is-widget-maximized .customer-account-debtors-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized {
    padding: 14px !important;
    overflow-y: auto !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-chart-wrap,
  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-collections-card.is-widget-maximized .customer-account-collections-chart-wrap {
    flex: 1 1 250px !important;
    width: 100% !important;
    min-height: 240px !important;
    max-height: none !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-chart-card.supplier-account-trend-card.is-widget-maximized:not(.customer-account-collections-card) {
    overflow-y: auto !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-chart-card.supplier-account-trend-card.is-widget-maximized:not(.customer-account-collections-card) .customer-account-chart-wrap {
    flex: 1 1 260px !important;
    min-height: 250px !important;
    max-height: none !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized {
    overflow-y: auto !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-shell {
    flex: 1 1 280px !important;
    min-height: 260px !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .supplier-purchase-payment-card.is-widget-maximized .supplier-purchase-payment-chart-wrap {
    min-height: 220px !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-chart-card.supplier-account-dpo-card.is-widget-maximized {
    overflow-y: auto !important;
  }

  body.dashboard-theme.widget-maximized > .widget-modal-backdrop > .customer-account-chart-card.supplier-account-dpo-card.is-widget-maximized .supplier-account-dpo-chart-wrap {
    flex: 1 1 260px !important;
    min-height: 250px !important;
  }
}

/* ========================================================================== */
/* Ventas · detalle de pedido — cabecera colapsable en móvil                  */
/* ========================================================================== */
/* En escritorio se conserva exactamente la cabecera completa. En teléfono,
   los datos administrativos pasan a un acordeón para priorizar los artículos
   y evitar columnas comprimidas o valores cortados. */
.dashboard-theme .sales-order-detail-mobile-toggle,
.dashboard-theme .sales-order-detail-mobile-quick-summary {
  display: none;
}

.dashboard-theme .sales-order-detail-mobile-collapsible {
  display: contents;
}

@media (max-width: 767px) {
  .dashboard-theme .sales-order-detail-modal-card {
    overflow: hidden;
  }

  .dashboard-theme .sales-order-detail-content {
    gap: 8px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
  }

  .dashboard-theme .sales-order-detail-mobile-toggle {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid rgba(17, 24, 28, .11);
    border-radius: 11px;
    color: #18211f;
    background: #fffdf9;
    font: inherit;
    font-size: .68rem;
    font-weight: 900;
    text-align: left;
    cursor: pointer;
  }

  .dashboard-theme .sales-order-detail-mobile-toggle:focus-visible {
    outline: 2px solid rgba(23, 107, 91, .45);
    outline-offset: 2px;
  }

  .dashboard-theme .sales-order-detail-mobile-toggle-icon {
    display: inline-grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    border-radius: 50%;
    color: #176b5b;
    background: #edf6f2;
    font-size: .95rem;
    line-height: 1;
    transition: transform 160ms ease;
  }

  .dashboard-theme .sales-order-detail-content.is-mobile-details-expanded .sales-order-detail-mobile-toggle-icon {
    transform: rotate(180deg);
  }

  .dashboard-theme .sales-order-detail-mobile-quick-summary {
    display: block;
    flex: 0 0 auto;
    margin-top: -2px;
    padding: 0 3px;
    color: #68736f;
    font-size: .60rem;
    font-weight: 800;
    line-height: 1.25;
  }

  .dashboard-theme .sales-order-detail-mobile-collapsible {
    display: none;
  }

  .dashboard-theme .sales-order-detail-content.is-mobile-details-expanded .sales-order-detail-mobile-collapsible {
    display: grid;
    flex: 0 0 auto;
    gap: 6px;
  }

  .dashboard-theme .sales-order-detail-content.is-mobile-details-expanded .sales-order-detail-mobile-quick-summary {
    display: none;
  }

  /* Cuando el usuario abre Datos del pedido se muestra toda la información,
     una fila por campo, para que ningún valor quede fuera del viewport. */
  .dashboard-theme .sales-order-detail-mobile-collapsible .sales-order-detail-summary,
  .dashboard-theme .sales-order-detail-mobile-collapsible .sales-order-detail-contact-row,
  .dashboard-theme .sales-order-detail-mobile-collapsible .sales-order-detail-delivery-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .dashboard-theme .sales-order-detail-mobile-collapsible .sales-order-detail-summary strong,
  .dashboard-theme .sales-order-detail-mobile-collapsible .sales-order-detail-contact-row strong,
  .dashboard-theme .sales-order-detail-mobile-collapsible .sales-order-detail-delivery-row strong,
  .dashboard-theme .sales-order-detail-mobile-collapsible .sales-order-detail-observation strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .dashboard-theme .sales-order-detail-mobile-collapsible .sales-order-detail-observation {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .dashboard-theme .sales-order-detail-mobile-collapsible .sales-order-detail-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* El listado de artículos participa del scroll general del cuerpo del modal.
     Evita tener dos scrolls verticales anidados cuando se despliega la cabecera. */
  .dashboard-theme .sales-order-detail-table-wrap {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-theme .sales-order-detail-mobile-toggle-icon {
    transition: none;
  }
}

/* Tesorería — referencias de comprobantes dentro de recibos, órdenes de pago
   y movimientos de valor. */
.dashboard-theme .treasury-document-reference-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 26px;
  padding: 3px 6px;
  border: 0;
  border-radius: 7px;
  color: #29473f;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.dashboard-theme .treasury-document-reference-button > span:first-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}
.dashboard-theme .treasury-document-reference-button strong,
.dashboard-theme .treasury-document-reference-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-theme .treasury-document-reference-button strong { color: #214b3e; font-weight: 950; }
.dashboard-theme .treasury-document-reference-button small { color: #7a8881; font-size: .49rem; line-height: 1.15; }
.dashboard-theme .treasury-document-reference-chevron { flex: 0 0 auto; color: #b56b08; font-size: .92rem; font-weight: 950; line-height: 1; }
.dashboard-theme .treasury-document-reference-button:hover,
.dashboard-theme .treasury-document-reference-button:focus-visible,
.dashboard-theme .treasury-document-reference-button[aria-expanded="true"] {
  color: #8b5200;
  background: rgba(216, 132, 16, .10);
  outline: 0;
}
.treasury-document-action-menu { z-index: 5200; }
.treasury-document-action-menu .treasury-document-action-item:disabled,
.treasury-document-action-menu .treasury-document-action-item:disabled:hover,
.treasury-document-action-menu .treasury-document-action-item:disabled:focus-visible {
  color: #969a98;
  background: transparent;
  cursor: default;
  opacity: .58;
}
.treasury-document-action-menu .treasury-document-action-item:not(:disabled) { color: #8b5200; }
.dashboard-theme .treasury-value-movement-documents-table { min-width: 820px; }

.treasury-document-viewer {
  width: min(1120px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 28px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(12, 18, 16, .32);
  overflow: hidden;
}
.treasury-document-viewer::backdrop { background: rgba(12, 18, 16, .48); }
.treasury-document-viewer-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); width: 100%; height: 100%; background: #fff; }
.treasury-document-viewer-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 58px; padding: 10px 14px; border-bottom: 1px solid #dce5df; background: #f8faf8; }
.treasury-document-viewer-header > div { display: grid; min-width: 0; gap: 2px; }
.treasury-document-viewer-header strong { overflow: hidden; color: #173f36; font-size: .86rem; font-weight: 950; text-overflow: ellipsis; white-space: nowrap; }
.treasury-document-viewer-header span { color: #718078; font-size: .6rem; font-weight: 750; }
.treasury-document-viewer-close { width: 31px; height: 31px; flex: 0 0 31px; border: 1px solid #d7e0da; border-radius: 50%; color: #344941; background: #fff; font-size: 1.15rem; line-height: 1; cursor: pointer; }
.treasury-document-viewer-close:hover,
.treasury-document-viewer-close:focus-visible { border-color: #b56b08; color: #8b5200; outline: 0; }
.treasury-document-viewer-content { min-height: 0; overflow: auto; background: #e9eeeb; }
.treasury-document-viewer-content iframe { display: block; width: 100%; height: 100%; min-height: 72vh; border: 0; background: #fff; }
.treasury-document-viewer-content img { display: block; max-width: 100%; height: auto; margin: 0 auto; background: #fff; }
.treasury-document-viewer-message { display: grid; place-items: center; align-content: center; gap: 5px; min-height: 100%; margin: 0; padding: 32px; color: #66756e; text-align: center; }
.treasury-document-viewer-message strong { color: #203f36; font-size: .9rem; font-weight: 950; }
.treasury-document-viewer-message span { max-width: 38rem; font-size: .7rem; line-height: 1.4; }
@media (max-width: 700px) {
  .treasury-document-viewer { width: calc(100vw - 12px); height: calc(100vh - 12px); }
  .treasury-document-viewer-header span { display: none; }
  .treasury-document-viewer-content iframe { min-height: 82vh; }
}

/* ========================================================================== */
/* Contabilidad General — Listado de imputaciones                             */
/* ========================================================================== */
.icon-pen {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round' d='M5 20l3.3-.8L19 8.5 15.5 5 4.8 15.7 4 19.9l1-.2ZM14.3 6.2l3.5 3.5M4.8 15.7l3.5 3.5M12 21h8'/%3E%3C/svg%3E");
}

.icon-filter {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M4 5h16l-6 7v6l-4 2v-8L4 5Z'/%3E%3C/svg%3E");
}

.icon-download {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M12 4v11m-4-4 4 4 4-4M5 20h14'/%3E%3C/svg%3E");
}

.icon-printer {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round' d='M7 8V4h10v4M7 17H5a2 2 0 0 1-2-2v-5h18v5a2 2 0 0 1-2 2h-2M7 14h10v6H7v-6Zm10-2h.01'/%3E%3C/svg%3E");
}

.accounting-imputation-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
  align-items: start;
}

.accounting-imputation-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #d7e3de;
  border-radius: 18px;
  background: #fbfcfa;
  box-shadow: 0 12px 28px rgba(20, 45, 38, 0.06);
}

.accounting-imputation-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.accounting-imputation-heading-copy {
  min-width: 0;
}

.accounting-imputation-heading .eyebrow {
  margin-bottom: 2px;
}

.accounting-imputation-heading h2 {
  margin: 0;
  color: #17302a;
  font-size: 1rem;
  line-height: 1.15;
}

.accounting-imputation-heading p {
  max-width: 760px;
  margin: 2px 0 0;
  color: #6d7f79;
  font-size: 0.62rem;
  line-height: 1.25;
}

.accounting-imputation-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 27px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e8f5ef;
  color: #17634f;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.accounting-imputation-heading .widget-control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.accounting-imputation-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #cfdcd7;
  border-radius: 9px;
  background: #fff;
  color: #294840;
  font: inherit;
  font-size: 0.71rem;
  font-weight: 800;
  cursor: pointer;
}

.accounting-imputation-action:hover {
  border-color: #8db8a9;
  background: #f0f8f4;
}

.accounting-imputation-action:focus-visible,
.accounting-imputation-module-buttons button:focus-visible,
.accounting-imputation-detail-clear:focus-visible,
.accounting-imputation-filter-panel > summary:focus-visible,
.accounting-imputation-more-filters > summary:focus-visible {
  outline: 3px solid rgba(28, 128, 98, 0.18);
  outline-offset: 2px;
}

/* Filtros: visibles sólo en la vista expandida y colapsables dentro del modal. */
.accounting-imputation-filters {
  position: relative;
  z-index: 2;
  margin-bottom: 8px;
}

.accounting-imputation-filter-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid #d7e5df;
  border-radius: 13px;
  background: #eef6f2;
}

.accounting-imputation-filter-panel.has-account-popover {
  z-index: 40;
  overflow: visible;
}

.accounting-imputation-filter-panel.has-account-popover .accounting-imputation-filter-body,
.accounting-imputation-filter-panel.has-account-popover .accounting-imputation-more-filters,
.accounting-imputation-filter-panel.has-account-popover .accounting-imputation-advanced-grid {
  overflow: visible;
}

.accounting-imputation-filter-panel > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 10px;
  cursor: pointer;
  list-style: none;
}

.accounting-imputation-filter-panel > summary::-webkit-details-marker,
.accounting-imputation-more-filters > summary::-webkit-details-marker {
  display: none;
}

.accounting-imputation-filter-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #24584b;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.accounting-imputation-filter-title .ui-icon {
  width: 14px;
  height: 14px;
}

.accounting-imputation-filter-summary {
  overflow: hidden;
  color: #60736d;
  font-size: .66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-filter-chevron {
  color: #47695f;
  font-size: .82rem;
  font-weight: 900;
  transition: transform .15s ease;
}

.accounting-imputation-filter-panel:not([open]) .accounting-imputation-filter-chevron {
  transform: rotate(180deg);
}

.accounting-imputation-filter-body {
  padding: 0 10px 9px;
  border-top: 1px solid #d7e5df;
}

.accounting-imputation-filter-grid {
  display: grid;
  grid-template-columns: minmax(128px, .72fr) minmax(128px, .72fr) minmax(190px, 1fr) minmax(260px, 1.4fr);
  gap: 8px;
  padding-top: 8px;
  align-items: end;
}

.accounting-imputation-filter-grid label,
.accounting-imputation-advanced-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.accounting-imputation-filter-grid label > span,
.accounting-imputation-advanced-grid label > span,
.accounting-imputation-module-filter > span:first-child {
  color: #5b716a;
  font-size: 0.59rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.accounting-imputation-filter-grid input,
.accounting-imputation-filter-grid select,
.accounting-imputation-advanced-grid input {
  width: 100%;
  min-height: 33px;
  padding: 6px 9px;
  border: 1px solid #cad9d3;
  border-radius: 9px;
  background: #fff;
  color: #203b34;
  font: inherit;
  font-size: .72rem;
}

.accounting-imputation-filter-grid input:focus,
.accounting-imputation-filter-grid select:focus,
.accounting-imputation-advanced-grid input:focus {
  border-color: #58a58d;
  outline: 3px solid rgba(38, 139, 107, .1);
}

.accounting-imputation-search-control {
  position: relative;
}

.accounting-imputation-search-control .ui-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  width: 14px;
  height: 14px;
  color: #5b746c;
  transform: translateY(-50%);
  pointer-events: none;
}

.accounting-imputation-search-control input {
  padding-left: 30px;
}

.accounting-imputation-module-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #d5e3dd;
}

.accounting-imputation-module-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  overflow-x: visible;
}

.accounting-imputation-module-buttons button {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid #c7d9d2;
  border-radius: 14px;
  background: #fff;
  color: #31584d;
  font: inherit;
  font-size: .64rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.accounting-imputation-module-kpi-label {
  display: block;
  flex: 0 0 auto;
  line-height: 1.1;
}

.accounting-imputation-module-kpi-metrics {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  color: #60736d;
  font-size: .53rem;
  font-weight: 700;
  line-height: 1.15;
}

.accounting-imputation-module-kpi-count {
  display: none;
}

.accounting-imputation-module-kpi-value {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-left: 6px;
  margin-left: 6px;
  border-left: 1px solid rgba(96, 115, 109, .24);
  white-space: nowrap;
}

.accounting-imputation-module-kpi-value:first-child {
  padding-left: 0;
  margin-left: 0;
  border-left: 0;
}

.accounting-imputation-module-kpi-value > span {
  font-size: .54rem;
  font-weight: 900;
  opacity: .82;
}

.accounting-imputation-module-kpi-metrics strong {
  color: inherit;
  font-size: inherit;
  font-weight: 850;
}

.accounting-imputation-module-kpi-value.is-balance strong {
  font-weight: 950;
}

.accounting-imputation-module-buttons button:hover {
  border-color: #82b5a4;
  background: #f5faf8;
}

.accounting-imputation-module-buttons button[aria-pressed="true"] {
  border-color: #0d5c4a;
  background: #0d5c4a;
  color: #fff;
}

.accounting-imputation-module-buttons button[aria-pressed="true"] .accounting-imputation-module-kpi-metrics {
  color: rgba(255, 255, 255, .88);
}

.accounting-imputation-module-buttons button[aria-pressed="true"] .accounting-imputation-module-kpi-value {
  border-left-color: rgba(255, 255, 255, .24);
}

.accounting-imputation-module-hint {
  overflow: hidden;
  color: #60736d;
  font-size: .62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: center;
}

.accounting-imputation-more-filters {
  margin-top: 7px;
}

.accounting-imputation-more-filters > summary {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  color: #346357;
  font-size: .66rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.accounting-imputation-more-filters > summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 5px;
  border-radius: 50%;
  background: #dcece6;
  color: #1d6653;
  font-weight: 900;
}

.accounting-imputation-more-filters[open] > summary::before {
  content: "−";
}

.accounting-imputation-advanced-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5px;
  padding-top: 6px;
  border-top: 1px solid #d5e3dd;
}

.accounting-imputation-advanced-toolbar > span {
  color: #5b716a;
  font-size: .59rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.accounting-imputation-advanced-toolbar .ghost-button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: .63rem;
  white-space: nowrap;
}

.accounting-imputation-advanced-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.accounting-imputation-state {
  flex: 0 0 auto;
  margin: 0 0 7px;
  padding: 7px 9px;
  border-radius: 9px;
  background: #f1f6f4;
  color: #476159;
  font-size: .7rem;
  font-weight: 700;
}

.accounting-imputation-state[data-state="error"] {
  background: #fff0ed;
  color: #a13c2d;
}

.accounting-imputation-state[data-state="loading"]::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 7px;
  border: 2px solid #a6c8bc;
  border-top-color: #17634f;
  border-radius: 50%;
  vertical-align: -2px;
  animation: accounting-spin .8s linear infinite;
}

@keyframes accounting-spin {
  to { transform: rotate(360deg); }
}

.accounting-imputation-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid #dbe5e1;
  border-radius: 11px;
  background: #fff;
  scrollbar-gutter: stable;
}

.accounting-imputation-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: #243d36;
  font-size: .69rem;
}

.accounting-imputation-table th,
.accounting-imputation-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #e5ece9;
  vertical-align: middle;
}

.accounting-imputation-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #0d4d40;
  color: #fff;
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .025em;
  text-transform: uppercase;
  white-space: nowrap;
}

.accounting-imputation-table tfoot th,
.accounting-imputation-table tfoot td {
  position: sticky;
  z-index: 1;
  bottom: 0;
  border-bottom: 0;
  border-top: 1px solid #cfe0d9;
  background: #e1f1e9;
  color: #20483d;
  font-weight: 900;
}

.accounting-imputation-table tbody tr:hover td {
  background: #f2f8f5;
}

.accounting-imputation-table .number-cell {
  text-align: right;
  white-space: nowrap;
}

.accounting-imputation-drill-column {
  width: 27px;
  padding-inline: 3px !important;
  text-align: center;
}

.accounting-imputation-open-glyph {
  color: #4d7c6e;
  font-size: .95rem;
  font-weight: 900;
}

.accounting-imputation-empty td {
  padding: 18px 10px !important;
  color: #6e7f79;
  text-align: center;
}

.accounting-imputation-module-name,
.accounting-imputation-document-main {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.accounting-imputation-module-name strong,
.accounting-imputation-document-main strong {
  overflow: hidden;
  color: #1d5e4d;
  font-size: .69rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-module-name small,
.accounting-imputation-document-main small {
  color: #7b8b86;
  font-size: .59rem;
  font-weight: 650;
}

.accounting-imputation-status-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: .61rem;
  font-weight: 850;
  white-space: nowrap;
}

.accounting-imputation-status-pill.is-posted {
  background: #e4f4ed;
  color: #12614d;
}

.accounting-imputation-status-pill.is-pending {
  background: #fff4d9;
  color: #835a0a;
}

/* Vista compacta: sólo el resumen por módulo, como el resto de cards. */
.accounting-imputation-card:not(.is-widget-maximized) {
  height: 270px;
  min-height: 270px;
  max-height: 270px;
  overflow: hidden;
}

.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-action,
.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-filters,
.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-state,
.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-workspace {
  display: none !important;
}

.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-heading {
  min-height: 52px;
  margin-bottom: 6px;
}

.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-summary-table-wrap {
  max-height: 188px;
}

.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-summary-table {
  min-width: 0;
  font-size: .63rem;
}

.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-summary-table th,
.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-summary-table td {
  padding: 5px 6px;
}

.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-summary-table thead th {
  font-size: .53rem;
}

.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-module-name small {
  display: none;
}

.accounting-imputation-card:not(.is-widget-maximized) .accounting-imputation-summary-table tbody tr[data-accounting-module-open] {
  cursor: pointer;
}

/* Modal maximizado: casi toda la pantalla y workspace master/detail 62/38. */
.widget-modal-backdrop:has(> .accounting-imputation-card.is-widget-maximized) {
  padding: 8px 10px !important;
}

.dashboard-theme .widget-modal-backdrop > .accounting-imputation-card.is-widget-maximized {
  --widget-modal-width: calc(100vw - 20px);
  width: calc(100vw - 20px) !important;
  max-width: calc(100vw - 20px) !important;
  height: calc(100dvh - 16px) !important;
  min-height: calc(100dvh - 16px) !important;
  max-height: calc(100dvh - 16px) !important;
  align-self: center !important;
  padding: 13px 15px !important;
  overflow: hidden !important;
  border-radius: 20px !important;
  display: flex;
  flex-direction: column;
}

.accounting-imputation-card.is-widget-maximized .accounting-imputation-heading {
  flex: 0 0 auto;
  margin-bottom: 7px;
}

.accounting-imputation-card.is-widget-maximized .accounting-imputation-heading h2 {
  font-size: 1.08rem;
}

.accounting-imputation-card.is-widget-maximized .accounting-imputation-heading p {
  font-size: .66rem;
}

.accounting-imputation-card.is-widget-maximized .accounting-imputation-summary-view {
  display: none !important;
}

.accounting-imputation-card.is-widget-maximized .accounting-imputation-workspace {
  position: relative;
  z-index: 1;
  display: grid !important;
  grid-template-columns: minmax(0, 1.55fr) minmax(430px, 1fr);
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
}

.accounting-imputation-master-pane,
.accounting-imputation-detail-pane {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #dbe5e1;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(18, 48, 39, .035);
}

.accounting-imputation-master-pane {
  display: flex;
  flex-direction: column;
  padding: 9px;
}

.accounting-imputation-detail-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 9px;
  background: #f9fbfa;
}

.accounting-imputation-pane-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 38px;
  margin-bottom: 5px;
}

.accounting-imputation-pane-heading > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.accounting-imputation-pane-heading .eyebrow {
  margin: 0;
  color: #a86712;
  font-size: .56rem;
  letter-spacing: .055em;
}

.accounting-imputation-pane-heading h3 {
  overflow: hidden;
  margin: 0;
  color: #203d35;
  font-size: .82rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-pane-heading p {
  overflow: hidden;
  margin: 1px 0 0;
  color: #72827d;
  font-size: .62rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-documents-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.accounting-imputation-documents-table {
  min-width: 820px;
}

.accounting-imputation-documents-table tbody tr {
  cursor: pointer;
}

.accounting-imputation-documents-table tbody tr.is-selected td {
  background: #e4f3ed;
}

.accounting-imputation-documents-table .accounting-imputation-date-cell {
  width: 78px;
  white-space: nowrap;
}

.accounting-imputation-documents-table .accounting-imputation-observation-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 32px;
  padding-top: 6px;
}

.accounting-imputation-pagination span {
  min-width: 110px;
  color: #5f726c;
  font-size: .66rem;
  font-weight: 750;
  text-align: center;
}

.accounting-imputation-pagination .ghost-button {
  min-height: 27px;
  padding: 4px 9px;
  font-size: .65rem;
}

.accounting-imputation-detail-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 30px;
  color: #70817b;
  text-align: center;
}

.accounting-imputation-detail-empty .ui-icon {
  width: 24px;
  height: 24px;
  color: #6c9084;
}

.accounting-imputation-detail-empty strong {
  color: #31564c;
  font-size: .84rem;
}

.accounting-imputation-detail-empty p {
  max-width: 300px;
  margin: 0;
  font-size: .68rem;
  line-height: 1.35;
}

.accounting-imputation-detail-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.accounting-imputation-detail-content[hidden],
.accounting-imputation-detail-empty[hidden] {
  display: none !important;
}

.accounting-imputation-detail-clear {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #c9d9d3;
  border-radius: 8px;
  background: #fff;
  color: #2b6253;
  font: inherit;
  font-size: .63rem;
  font-weight: 800;
  cursor: pointer;
}

.accounting-imputation-detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  flex: 0 0 auto;
  margin-bottom: 7px;
}

.accounting-imputation-detail-summary > span {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 43px;
  padding: 5px 7px;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #fff;
}

.accounting-imputation-detail-summary small {
  color: #73847e;
  font-size: .53rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.accounting-imputation-detail-summary strong {
  overflow: hidden;
  color: #25453c;
  font-size: .67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-detail-table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 2px 1px 5px;
}

.accounting-imputation-detail-table-heading strong {
  color: #24473d;
  font-size: .72rem;
}

.accounting-imputation-detail-table-heading span {
  color: #72827d;
  font-size: .61rem;
}

.accounting-imputation-detail-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.accounting-imputation-detail-table {
  min-width: 560px;
  table-layout: fixed;
  font-size: .62rem;
}

.accounting-imputation-detail-table th:nth-child(1),
.accounting-imputation-detail-table td:nth-child(1) { width: 30%; }
.accounting-imputation-detail-table th:nth-child(2),
.accounting-imputation-detail-table td:nth-child(2) { width: 28%; }
.accounting-imputation-detail-table th:nth-child(3),
.accounting-imputation-detail-table td:nth-child(3),
.accounting-imputation-detail-table th:nth-child(4),
.accounting-imputation-detail-table td:nth-child(4),
.accounting-imputation-detail-table th:nth-child(5),
.accounting-imputation-detail-table td:nth-child(5) { width: 14%; }

.accounting-imputation-detail-table th,
.accounting-imputation-detail-table td {
  padding: 6px 6px;
}

.accounting-imputation-line-primary,
.accounting-imputation-line-context {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.accounting-imputation-line-primary strong {
  color: #195d4b;
  font-size: .64rem;
}

.accounting-imputation-line-primary span,
.accounting-imputation-line-context span {
  overflow: hidden;
  color: #526c64;
  font-size: .58rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-line-primary small {
  color: #8a7660;
  font-size: .54rem;
  font-weight: 700;
}

@media (max-width: 1280px) {
  .accounting-imputation-filter-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

  .accounting-imputation-module-buttons {
    flex-wrap: wrap;
  }

  .accounting-imputation-module-hint {
    white-space: normal;
  }

  .accounting-imputation-advanced-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .accounting-imputation-card.is-widget-maximized .accounting-imputation-workspace {
    grid-template-columns: minmax(0, 1.55fr) minmax(390px, 1fr);
  }
}

@media (max-width: 980px) {
  .accounting-imputation-shell {
    grid-template-columns: 1fr;
  }

  .accounting-imputation-card.is-widget-maximized .accounting-imputation-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(340px, .85fr);
  }

  .accounting-imputation-detail-table {
    min-width: 520px;
  }
}

@media (max-width: 760px) {
  .accounting-imputation-card {
    padding: 10px;
    border-radius: 14px;
  }

  .accounting-imputation-card:not(.is-widget-maximized) {
    height: auto;
    min-height: 250px;
    max-height: none;
  }

  .accounting-imputation-heading {
    grid-template-columns: 1fr auto;
  }

  .accounting-imputation-heading-copy {
    grid-column: 1 / -1;
  }

  .accounting-imputation-filter-panel > summary {
    grid-template-columns: auto 1fr auto;
  }

  .accounting-imputation-filter-summary {
    display: none;
  }

  .accounting-imputation-filter-grid,
  .accounting-imputation-advanced-grid {
    grid-template-columns: 1fr;
  }

  .widget-modal-backdrop:has(> .accounting-imputation-card.is-widget-maximized) {
    padding: 5px !important;
  }

  .dashboard-theme .widget-modal-backdrop > .accounting-imputation-card.is-widget-maximized {
    width: calc(100vw - 10px) !important;
    max-width: calc(100vw - 10px) !important;
    height: calc(100dvh - 10px) !important;
    min-height: calc(100dvh - 10px) !important;
    max-height: calc(100dvh - 10px) !important;
    padding: 9px !important;
    border-radius: 14px !important;
  }

  .accounting-imputation-card.is-widget-maximized .accounting-imputation-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(330px, 1.15fr) minmax(300px, .85fr);
    overflow: auto;
  }
}

/* Contabilidad General — refinamiento de filtros persistentes y detalle compacto. */
.accounting-imputation-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 42%);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 5px 8px;
}

.accounting-imputation-filter-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 31px;
  padding: 4px 3px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.accounting-imputation-filter-toggle:focus-visible,
.accounting-imputation-search-persistent input:focus-visible {
  outline: 3px solid rgba(28, 128, 98, .18);
  outline-offset: 2px;
}

.accounting-imputation-filter-toggle[aria-expanded="false"] .accounting-imputation-filter-chevron {
  transform: rotate(180deg);
}

.accounting-imputation-search-persistent {
  display: block;
  min-width: 0;
}

.accounting-imputation-search-persistent .accounting-imputation-search-control {
  width: 100%;
}

.accounting-imputation-search-persistent input {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px 6px 30px;
  border: 1px solid #cad9d3;
  border-radius: 9px;
  background: #fff;
  color: #203b34;
  font: inherit;
  font-size: .72rem;
}

.accounting-imputation-search-persistent input:focus {
  border-color: #58a58d;
  outline: 3px solid rgba(38, 139, 107, .1);
}

.accounting-imputation-filter-body[hidden] {
  display: none !important;
}

.accounting-imputation-filter-body {
  padding-top: 1px;
}

.accounting-imputation-filter-grid {
  grid-template-columns: minmax(128px, .8fr) minmax(128px, .8fr) minmax(210px, 1.2fr);
}

.accounting-imputation-filter-panel.is-collapsed .accounting-imputation-filter-toolbar {
  min-height: 40px;
}

.accounting-imputation-detail-heading {
  min-height: 0;
  margin-bottom: 4px;
}

.accounting-imputation-detail-heading-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  min-width: 0;
}

.accounting-imputation-detail-heading .eyebrow {
  margin-bottom: 0;
}

.accounting-imputation-detail-heading h3 {
  font-size: .78rem;
}

.accounting-imputation-detail-heading p {
  margin-top: 0;
  font-size: .59rem;
}

.accounting-imputation-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
  margin-top: 4px;
}

.accounting-imputation-detail-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 24px;
  padding: 3px 6px;
  border: 1px solid #dce7e2;
  border-radius: 7px;
  background: #fff;
}

.accounting-imputation-detail-meta small {
  color: #73847e;
  font-size: .49rem;
  font-weight: 850;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.accounting-imputation-detail-meta strong {
  overflow: hidden;
  max-width: 170px;
  color: #25453c;
  font-size: .61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-detail-meta .accounting-imputation-status-pill {
  padding: 2px 5px;
  font-size: .57rem;
}

.accounting-imputation-detail-table-heading {
  min-height: 23px;
  padding: 0 1px 4px;
}

.accounting-imputation-detail-clear {
  min-height: 26px;
  padding: 3px 7px;
  font-size: .59rem;
}

.accounting-imputation-detail-table-wrap {
  flex: 1 1 auto;
}

@media (max-width: 1100px) {
  .accounting-imputation-filter-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 44%);
  }

  .accounting-imputation-filter-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

@media (max-width: 760px) {
  .accounting-imputation-filter-toolbar {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 6px 8px;
  }

  .accounting-imputation-filter-toggle {
    min-height: 28px;
  }

  .accounting-imputation-filter-summary {
    display: block;
  }

  .accounting-imputation-filter-grid {
    grid-template-columns: 1fr;
  }

  .accounting-imputation-detail-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .accounting-imputation-detail-meta > span {
    justify-content: flex-start;
  }
}

/* Reset the legacy <details> chevron rule now that the filter shell uses a button. */
.accounting-imputation-filter-panel .accounting-imputation-filter-chevron {
  transform: none;
}

.accounting-imputation-filter-toggle[aria-expanded="false"] .accounting-imputation-filter-chevron {
  transform: rotate(180deg);
}

/* Contabilidad General — búsqueda asistida de cuentas, grupos y centros de costo */
.accounting-imputation-account-field {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.accounting-imputation-account-label {
  color: #5b716a;
  font-size: .59rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.accounting-imputation-account-control {
  display: grid;
  grid-template-columns: 16px auto 8px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 33px;
  padding: 6px 9px;
  border: 1px solid #cad9d3;
  border-radius: 9px;
  background: #fff;
  color: #203b34;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.accounting-imputation-account-control:hover {
  border-color: #82b5a4;
  background: #f8fbfa;
}

.accounting-imputation-account-control:focus-visible,
.accounting-imputation-account-control[aria-expanded="true"] {
  border-color: #58a58d;
  outline: 3px solid rgba(38, 139, 107, .1);
}

.accounting-imputation-account-control .ui-icon {
  width: 14px;
  height: 14px;
  color: #4f7268;
}

.accounting-imputation-account-control > strong {
  color: #234b40;
  font-size: .69rem;
  font-weight: 850;
  white-space: nowrap;
}

.accounting-imputation-account-separator {
  color: #a5b6b0;
  font-size: .7rem;
  text-align: center;
}

.accounting-imputation-account-description {
  overflow: hidden;
  min-width: 0;
  color: #536a63;
  font-size: .64rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-account-control.is-missing {
  border-color: #efd5c5;
  background: #fff8f3;
}

.accounting-imputation-account-description.is-missing {
  color: #9b5b36;
}

.accounting-imputation-account-popover {
  position: absolute;
  z-index: 120;
  top: calc(100% + 5px);
  left: 0;
  width: min(440px, calc(100vw - 56px));
  padding: 8px;
  border: 1px solid #c8d9d2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 46, 38, .18);
}

.accounting-imputation-account-popover[hidden] {
  display: none !important;
}

/* El centro de costo está en la última columna del filtro. Anclar su selector
   al borde derecho evita que el popover salga del modal en pantallas angostas. */
[data-accounting-cost-center-field] .accounting-imputation-account-popover {
  right: 0;
  left: auto;
}

.accounting-imputation-account-search {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 5px;
  margin-bottom: 7px;
}

.accounting-imputation-account-search > .ui-icon {
  position: absolute;
  z-index: 1;
  left: 9px;
  top: 50%;
  width: 14px;
  height: 14px;
  color: #5b746c;
  transform: translateY(-50%);
  pointer-events: none;
}

.accounting-imputation-account-search > input {
  min-height: 34px;
  padding-left: 30px;
}

.accounting-imputation-account-search > button {
  min-width: 30px;
  min-height: 34px;
  padding: 0;
  border: 1px solid #d4dfdb;
  border-radius: 8px;
  background: #f7faf8;
  color: #4c655d;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.accounting-imputation-account-results {
  display: grid;
  gap: 3px;
  max-height: 250px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.accounting-imputation-account-result {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #263f38;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.accounting-imputation-account-result:hover,
.accounting-imputation-account-result:focus-visible {
  background: #edf6f2;
  outline: none;
}

.accounting-imputation-account-result strong {
  color: #155f4d;
  font-size: .68rem;
  white-space: nowrap;
}

.accounting-imputation-account-result span {
  overflow: hidden;
  color: #536a63;
  font-size: .66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-account-empty {
  padding: 14px 10px;
  color: #6b7d77;
  font-size: .67rem;
  text-align: center;
}

.accounting-imputation-account-empty.is-error {
  color: #a13c2d;
}

@media (max-width: 760px) {

  .accounting-imputation-advanced-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .accounting-imputation-account-popover {
    width: min(440px, calc(100vw - 36px));
  }
}

/* ========================================================================== */
/* Contabilidad General — consulta de asiento contable                        */
/* ========================================================================== */
.accounting-journal-entry-link {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 900;
  line-height: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
}

.accounting-journal-entry-link:hover {
  color: #083f33;
}

.accounting-journal-entry-link:focus-visible {
  outline: 2px solid rgba(20, 101, 79, .28);
  outline-offset: 2px;
  border-radius: 3px;
}

body.accounting-journal-entry-open {
  overflow: hidden;
}

.accounting-journal-entry-backdrop {
  position: fixed;
  z-index: 14050;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 12, 14, .58);
}

.accounting-journal-entry-backdrop[hidden] {
  display: none !important;
}

.accounting-journal-entry-dialog {
  display: flex;
  flex-direction: column;
  width: min(1060px, calc(100vw - 40px));
  max-height: min(760px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid rgba(245, 159, 47, .34);
  border-radius: 18px;
  background: #fbfcfa;
  box-shadow: 0 30px 90px rgba(4, 10, 12, .38);
  outline: none;
}

.accounting-journal-entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex: 0 0 auto;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e0e8e4;
}

.accounting-journal-entry-header > div {
  min-width: 0;
}

.accounting-journal-entry-header .eyebrow {
  margin: 0 0 3px;
  color: #b76c10;
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.accounting-journal-entry-header h2 {
  margin: 0;
  color: #173c32;
  font-size: 1.16rem;
  line-height: 1.2;
}

.accounting-journal-entry-header p {
  margin: 3px 0 0;
  color: #71817c;
  font-size: .7rem;
}

.accounting-journal-entry-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #eef6f2;
  color: #315b50;
  font-size: .74rem;
}

.accounting-journal-entry-state[data-state="error"] {
  background: #fff0ed;
  color: #a13c2d;
}

.accounting-journal-entry-content {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  padding: 12px 18px 16px;
}

.accounting-journal-entry-summary {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(180px, 1fr) minmax(0, 1.55fr) minmax(0, 1.55fr);
  gap: 8px;
  flex: 0 0 auto;
}

.accounting-journal-entry-summary > span {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid #dbe6e1;
  border-radius: 9px;
  background: #f6faf8;
}

.accounting-journal-entry-summary small {
  color: #74847f;
  font-size: .56rem;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.accounting-journal-entry-summary strong {
  overflow: hidden;
  color: #24463d;
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-journal-entry-table-wrap {
  flex: 1 1 auto;
  min-height: 220px;
  overflow: auto;
  border: 1px solid #d7e3de;
  border-radius: 10px;
  background: #fff;
}

.accounting-journal-entry-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  color: #264139;
  font-size: .72rem;
}

.accounting-journal-entry-table th,
.accounting-journal-entry-table td {
  padding: 8px 9px;
  border-bottom: 1px solid #e6ece9;
  vertical-align: middle;
}

.accounting-journal-entry-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #0d5646;
  color: #fff;
  font-size: .61rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.accounting-journal-entry-table tfoot th {
  position: sticky;
  z-index: 1;
  bottom: 0;
  border-top: 1px solid #cde0d8;
  border-bottom: 0;
  background: #e1f1e9;
  color: #1f4a3e;
  font-weight: 900;
}

.accounting-journal-entry-table .number-cell {
  text-align: right;
  white-space: nowrap;
}

.accounting-journal-entry-balance {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex: 0 0 auto;
  color: #35554c;
  font-size: .72rem;
}

.accounting-journal-entry-balance strong {
  min-width: 130px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #edf4f1;
  color: #173f34;
  font-size: .8rem;
  text-align: right;
}

@media (max-width: 900px) {
  .accounting-journal-entry-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accounting-journal-entry-summary-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .accounting-journal-entry-backdrop {
    padding: 8px;
  }

  .accounting-journal-entry-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }

  .accounting-journal-entry-header,
  .accounting-journal-entry-content {
    padding-inline: 12px;
  }

  .accounting-journal-entry-summary {
    grid-template-columns: 1fr;
  }

  .accounting-journal-entry-summary-wide {
    grid-column: auto;
  }
}

/* ========================================================================== */
/* Contabilidad + Tesorería — paleta estructural grafito                      */
/* Mantiene los colores semánticos (errores/pendientes/importes) y reemplaza  */
/* el verde decorativo de cabeceras, selección y superficies por negro/grafito. */
/* ========================================================================== */

/* ---------- Contabilidad General ---------- */
.dashboard-theme .accounting-imputation-card {
  border-color: #d7dad7;
  background: #fbfbf8;
  box-shadow: 0 12px 28px rgba(17, 24, 28, .055);
}

.dashboard-theme .accounting-imputation-heading h2,
.dashboard-theme .accounting-imputation-pane-heading h3,
.dashboard-theme .accounting-imputation-detail-table-heading strong {
  color: #171f24;
}

.dashboard-theme .accounting-imputation-count {
  background: #eceeeb;
  color: #252f34;
}

.dashboard-theme .accounting-imputation-action {
  border-color: #cfd3d0;
  color: #253036;
  background: #fff;
}

.dashboard-theme .accounting-imputation-action:hover {
  border-color: #858d90;
  background: #f3f4f1;
}

.dashboard-theme .accounting-imputation-action:focus-visible,
.dashboard-theme .accounting-imputation-module-buttons button:focus-visible,
.dashboard-theme .accounting-imputation-detail-clear:focus-visible,
.dashboard-theme .accounting-imputation-filter-panel > summary:focus-visible,
.dashboard-theme .accounting-imputation-more-filters > summary:focus-visible {
  outline-color: rgba(245, 159, 47, .28);
}

.dashboard-theme .accounting-imputation-filter-panel {
  border-color: #d8dcda;
  background: #f1f2ef;
}

.dashboard-theme .accounting-imputation-filter-body,
.dashboard-theme .accounting-imputation-module-filter,
.dashboard-theme .accounting-imputation-advanced-toolbar {
  border-color: #d9ddda;
}

.dashboard-theme .accounting-imputation-filter-title,
.dashboard-theme .accounting-imputation-more-filters > summary,
.dashboard-theme .accounting-imputation-module-hint,
.dashboard-theme .accounting-imputation-filter-summary,
.dashboard-theme .accounting-imputation-filter-chevron {
  color: #465158;
}

.dashboard-theme .accounting-imputation-more-filters > summary::before {
  background: #e1e3e0;
  color: #252f34;
}

.dashboard-theme .accounting-imputation-module-buttons button {
  border-color: #cfd4d1;
  color: #303b40;
  background: #fff;
}

.dashboard-theme .accounting-imputation-module-buttons button:hover {
  border-color: #8c9497;
  background: #f3f4f1;
}

.dashboard-theme .accounting-imputation-module-buttons button[aria-pressed="true"] {
  border-color: #171f24;
  background: #171f24;
  color: #fff;
}

.dashboard-theme .accounting-imputation-module-buttons button .accounting-imputation-module-kpi-metrics {
  color: #687177;
}

.dashboard-theme .accounting-imputation-module-buttons button[aria-pressed="true"] .accounting-imputation-module-kpi-metrics {
  color: rgba(255, 255, 255, .78);
}

.dashboard-theme .accounting-imputation-table {
  color: #2e373b;
}

.dashboard-theme .accounting-imputation-table thead th,
.dashboard-theme .accounting-journal-entry-table thead th {
  border-bottom-color: #2c3438;
  background: #151c20;
  color: #fff;
}

.dashboard-theme .accounting-imputation-table tfoot th,
.dashboard-theme .accounting-imputation-table tfoot td,
.dashboard-theme .accounting-journal-entry-table tfoot th {
  border-top-color: #d0d4d1;
  background: #eceeeb;
  color: #20292e;
}

.dashboard-theme .accounting-imputation-table tbody tr:hover td {
  background: #f5f6f3;
}

.dashboard-theme .accounting-imputation-documents-table tbody tr.is-selected td {
  background: #f3f0e8;
}

.dashboard-theme .accounting-imputation-documents-table tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 #f59f2f;
}

.dashboard-theme .accounting-imputation-module-name strong,
.dashboard-theme .accounting-imputation-document-main strong,
.dashboard-theme .accounting-imputation-line-primary strong {
  color: #263136;
}

.dashboard-theme .accounting-imputation-open-glyph {
  color: #5d676c;
}

.dashboard-theme .accounting-imputation-status-pill.is-posted {
  background: #e9ebe8;
  color: #2c373c;
}

.dashboard-theme .accounting-imputation-master-pane,
.dashboard-theme .accounting-imputation-detail-pane {
  border-color: #dadeda;
  box-shadow: 0 3px 12px rgba(17, 24, 28, .035);
}

.dashboard-theme .accounting-imputation-detail-pane {
  background: #f7f8f5;
}

.dashboard-theme .accounting-imputation-detail-clear {
  border-color: #ced3d0;
  color: #303a3f;
}

/* Modal de asiento: misma identidad grafito que las grillas principales. */
.dashboard-theme .accounting-journal-entry-header h2,
.dashboard-theme .accounting-journal-entry-summary strong,
.dashboard-theme .accounting-journal-entry-balance strong {
  color: #1c252a;
}

.dashboard-theme .accounting-journal-entry-state {
  background: #f0f2ef;
  color: #3c474d;
}

.dashboard-theme .accounting-journal-entry-summary > span {
  border-color: #d9ddda;
  background: #f7f8f5;
}

.dashboard-theme .accounting-journal-entry-table-wrap {
  border-color: #d6dad7;
}

.dashboard-theme .accounting-journal-entry-balance {
  color: #3c474d;
}

.dashboard-theme .accounting-journal-entry-balance strong {
  background: #eceeeb;
}

.dashboard-theme .accounting-journal-entry-link:hover {
  color: #11181c;
}

.dashboard-theme .accounting-journal-entry-link:focus-visible {
  outline-color: rgba(245, 159, 47, .34);
}

/* ---------- Tesorería ---------- */
.dashboard-theme .treasury-movement-count {
  background: #eceeeb;
  color: #293338;
}

.dashboard-theme .treasury-movement-toolbar {
  border-color: #dbdeda;
  background: #f1f2ef;
}

.dashboard-theme .treasury-movement-field > span,
.dashboard-theme .treasury-movement-analysis-heading p,
.dashboard-theme .treasury-movement-detail-context small {
  color: #697277;
}

.dashboard-theme .treasury-movement-field select:focus,
.dashboard-theme .treasury-movement-field input:focus,
.dashboard-theme .treasury-movement-value-controls button:focus-visible,
.dashboard-theme .treasury-movement-analysis-heading-actions > button:focus-visible,
.dashboard-theme .treasury-movement-analysis-row:focus-visible td,
.dashboard-theme .treasury-movement-analysis-actions button:focus-visible {
  border-color: #7e878b;
  box-shadow: 0 0 0 3px rgba(245, 159, 47, .18);
}

.dashboard-theme .treasury-movement-value-controls button {
  border-color: #cdd2cf;
  color: #303a3f;
  background: #fff;
}

.dashboard-theme .treasury-movement-value-controls button:hover:not(:disabled) {
  border-color: #858d90;
  background: #f3f4f1;
}

.dashboard-theme .treasury-movement-analysis-panel {
  border-color: #d9ddda;
}

.dashboard-theme .treasury-movement-analysis-heading {
  border-bottom-color: #dedfdd;
  background: #f7f8f5;
}

.dashboard-theme .treasury-movement-analysis-heading h3,
.dashboard-theme .treasury-payment-order-section-heading h3,
.dashboard-theme .treasury-payment-order-totals strong,
.dashboard-theme .treasury-movement-detail-context strong {
  color: #20292e;
}

.dashboard-theme .treasury-movement-analysis-heading-actions > span,
.dashboard-theme .treasury-payment-order-section-heading > span {
  background: #e9ebe8;
  color: #3b464b;
}

.dashboard-theme .treasury-movement-analysis-heading-actions > button {
  border-color: #cfd4d1;
  color: #3b464b;
  background: #fff;
}

.dashboard-theme .treasury-movement-analysis-heading-actions > button:hover {
  border-color: #858d90;
  background: #f3f4f1;
}

.dashboard-theme .treasury-movement-analysis-table th,
.dashboard-theme .treasury-movement-table th,
.dashboard-theme .treasury-payment-order-table th {
  background: #151c20;
  color: #fff;
}

.dashboard-theme .treasury-movement-analysis-table td > strong,
.dashboard-theme .treasury-payment-order-table td > strong {
  color: #2c3539;
}

.dashboard-theme .treasury-movement-analysis-row:hover td,
.dashboard-theme .treasury-movement-table tbody tr:hover:not(.treasury-movement-detail-row) td {
  background: #f5f6f3;
}

.dashboard-theme .treasury-movement-analysis-row.is-selected td {
  background: #f3f0e8;
}

.dashboard-theme .treasury-movement-analysis-row.is-selected td:first-child {
  box-shadow: inset 3px 0 0 #f59f2f;
}

.dashboard-theme .treasury-movement-analysis-total-row td {
  background: #eff0ed;
}

.dashboard-theme .treasury-movement-analysis-total-row.is-selected td {
  background: #e8e9e6;
}

.dashboard-theme .treasury-movement-summary-net {
  color: #20292e !important;
}

.dashboard-theme .treasury-movement-analysis-actions button,
.dashboard-theme .treasury-movement-expand {
  border-color: #cfd4d1;
  color: #3d484d;
  background: #f2f3f0;
}

.dashboard-theme .treasury-movement-detail-context,
.dashboard-theme .treasury-movement-detail-row td,
.dashboard-theme .treasury-payment-order-summary > span,
.dashboard-theme .treasury-payment-order-totals > span,
.dashboard-theme .treasury-payment-order-state {
  border-color: #daddda;
  background: #f6f7f4;
}

.dashboard-theme .treasury-movement-table-wrap,
.dashboard-theme .treasury-movement-analysis-table-wrap,
.dashboard-theme .treasury-payment-order-section {
  border-color: #d9ddda;
}

/* Los importes de entrada/salida y los estados pendientes mantienen su color
   semántico para no perder información funcional. */

@media (max-width: 1500px) {
  .accounting-imputation-module-kpi-count {
    display: none;
  }
}

/* ========================================================================== */
/* Sistema visual unificado para tablas de datos                              */
/* ========================================================================== */
/*
   Referencia visual: tablas de Contabilidad General.
   Este bloque normaliza solamente la capa visual. No modifica anchos,
   table-layout, scroll, columnas, estados funcionales ni comportamiento JS.
*/
.dashboard-theme {
  --data-table-header-bg: #151c20;
  --data-table-header-border: #2c3438;
  --data-table-header-text: #ffffff;
  --data-table-text: #2e373b;
  --data-table-muted: #6f787d;
  --data-table-line: #e5e8e6;
  --data-table-frame: #d9ddda;
  --data-table-hover: #f5f6f3;
  --data-table-selected: #f3f0e8;
  --data-table-selected-accent: #f59f2f;
  --data-table-footer-bg: #eceeeb;
  --data-table-footer-text: #20292e;
}

/* Marcos: mismo borde fino, fondo blanco y esquinas que Contabilidad. */
.dashboard-theme :is(
  .ranking-table-wrap,
  .supplier-purchase-payment-detail-table-wrap,
  .customer-account-table-wrap,
  .customer-account-detail-table-wrap,
  .accounting-imputation-table-wrap,
  .accounting-journal-entry-table-wrap,
  .treasury-movement-analysis-table-wrap,
  .treasury-movement-table-wrap,
  .treasury-payment-order-table-wrap,
  .modal-table-wrap,
  .sales-orders-table-wrap,
  .sales-order-portfolio-table-wrap,
  .sales-order-detail-table-wrap,
  .sales-order-day-table-wrap,
  .inventory-evaluation-table-wrap,
  .purchase-supplier-orders-table-wrap,
  .configuration-report-table-wrap
) {
  border-color: var(--data-table-frame);
  border-radius: 11px;
  background: #fff;
}

/* Base cromática común sin alterar la geometría propia de cada tabla. */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) {
  color: var(--data-table-text);
  background: #fff;
}

/* Encabezado oscuro común. Se conserva sticky sólo donde ya existía. */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) thead th {
  border-bottom-color: var(--data-table-header-border);
  background: var(--data-table-header-bg);
  color: var(--data-table-header-text);
  font-weight: 900;
  letter-spacing: .025em;
  text-transform: uppercase;
}

/* Botones de ordenamiento integrados al encabezado, sin "botón dentro de tabla". */
.dashboard-theme :is(
  .ranking-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) thead th button {
  color: inherit;
  background: transparent;
}

/* Separadores de fila y tipografía de cuerpo. */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) tbody td {
  border-bottom-color: var(--data-table-line);
  color: var(--data-table-text);
}

/* Hover neutro. No pisa filas con estados funcionales (is-selected, is-pending, etc.). */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) tbody tr:not([class*="is-"]):hover td {
  background: var(--data-table-hover);
}

/* Selección coherente en todas las tablas que ya manejan .is-selected. */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) tbody tr.is-selected td {
  background: var(--data-table-selected);
}

.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--data-table-selected-accent);
}

/* Totales: banda gris clara como en Contabilidad General. */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) tfoot :is(th, td) {
  border-top-color: #d0d4d1;
  background: var(--data-table-footer-bg);
  color: var(--data-table-footer-text);
  font-weight: 900;
}

/* Importes alineados y estables visualmente en todas las familias. */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) .number-cell {
  font-variant-numeric: tabular-nums;
}


/* ========================================================================== */
/* Ajustes de consistencia de cabeceras - normalización de tablas v2          */
/* ========================================================================== */
/*
   Corrige las diferencias detectadas en Cartera abierta, detalle de Aging y
   tablas de Pedidos: elimina el espacio superior heredado de ranking-table,
   completa el fondo oscuro hasta las esquinas y unifica texto/sort en blanco.
*/

/* El border-spacing vertical de .ranking-table dejaba una franja clara sobre
   el encabezado. La tabla normalizada debe comenzar en el borde del contenedor. */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) {
  border-collapse: separate;
  border-spacing: 0;
}

/* Los drilldowns de Aging usan wrappers propios y deben tener el mismo marco. */
.dashboard-theme :is(
  .customer-account-aging-customers-wrap,
  .customer-account-aging-movements-wrap,
  .customer-account-table-wrap,
  .customer-account-detail-table-wrap,
  .sales-order-day-table-wrap
) {
  border-color: var(--data-table-frame);
  border-radius: 11px;
  background: #fff;
}

/* Cabecera oscura continua y con las esquinas superiores visibles. */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) thead tr:first-child > th {
  background: var(--data-table-header-bg) !important;
  color: var(--data-table-header-text) !important;
  box-shadow: none;
}

.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) thead tr:first-child > th:first-child {
  border-top-left-radius: 10px;
}

.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) thead tr:first-child > th:last-child {
  border-top-right-radius: 10px;
}

/* El texto clickeable de las cabeceras debe ser blanco. Varias tablas tenían
   colores propios en el botón y por eso no heredaban el color del TH. */
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) thead th button {
  color: #fff !important;
  background: transparent !important;
}

.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) thead th button:hover,
.dashboard-theme :is(
  .ranking-table,
  .accounting-imputation-table,
  .accounting-journal-entry-table,
  .treasury-movement-analysis-table,
  .treasury-movement-table,
  .treasury-payment-order-table,
  .sales-orders-table,
  .sales-order-day-table,
  .inventory-evaluation-table,
  .purchase-supplier-orders-table,
  .configuration-report-table
) thead th button:focus-visible {
  color: #fff !important;
  background: rgba(255, 255, 255, .06) !important;
}

/* Las ranking-table heredaban el antiguo indicador tipo "pill". Se reemplaza
   por una flecha limpia, sin fondo ni círculo. */
.dashboard-theme .ranking-table thead th[aria-sort] button::after {
  display: inline-block !important;
  width: auto !important;
  height: auto !important;
  min-width: 10px !important;
  min-height: 0 !important;
  margin-left: 4px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: rgba(255, 255, 255, .50) !important;
  content: "↕" !important;
  font-size: .68rem !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  box-shadow: none !important;
}

.dashboard-theme .ranking-table thead th[aria-sort="ascending"] button::after {
  color: #f59f2f !important;
  content: "↑" !important;
}

.dashboard-theme .ranking-table thead th[aria-sort="descending"] button::after {
  color: #f59f2f !important;
  content: "↓" !important;
}

/* Pedidos por día usa un <span> como indicador en vez de ::after. */
.dashboard-theme .sales-order-day-table thead th button > span[aria-hidden="true"] {
  color: rgba(255, 255, 255, .50) !important;
}

.dashboard-theme .sales-order-day-table thead th[aria-sort="ascending"] button > span[aria-hidden="true"],
.dashboard-theme .sales-order-day-table thead th[aria-sort="descending"] button > span[aria-hidden="true"] {
  color: #f59f2f !important;
}

/* Evita que los redondeos de fila del viejo ranking-table interfieran con el
   aspecto de grilla continua usado como patrón en Contabilidad General. */
.dashboard-theme :is(
  .customer-account-table,
  .customer-account-detail-table,
  .customer-account-aging-customers-table,
  .customer-account-aging-movements-table,
  .sales-order-day-table
) tbody td:first-child,
.dashboard-theme :is(
  .customer-account-table,
  .customer-account-detail-table,
  .customer-account-aging-customers-table,
  .customer-account-aging-movements-table,
  .sales-order-day-table
) tbody td:last-child {
  border-radius: 0;
}

/* ========================================================================== */
/* Contabilidad General — Balance de Sumas y Saldos                           */
/* ========================================================================== */
.accounting-trial-balance-card {
  min-width: 0;
}

.accounting-trial-balance-filters {
  /* El formulario debe formar una capa por encima del thead sticky. Sin esto,
     el encabezado de la tabla puede tapar el popover de los buscadores. */
  z-index: 60;
}

.accounting-trial-balance-filter-panel {
  padding: 0;
}

.accounting-trial-balance-filter-panel.has-account-popover {
  z-index: 80;
}

.accounting-trial-balance-filter-toolbar {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 42%);
  min-height: 42px;
  padding: 5px 8px;
  border-bottom: 1px solid #d7e5df;
}

.accounting-trial-balance-filter-body {
  padding: 0;
  border-top: 0;
}

.accounting-trial-balance-filter-panel.is-collapsed .accounting-trial-balance-filter-toolbar {
  min-height: 40px;
}

.accounting-trial-balance-search-persistent input {
  min-height: 32px;
}

.accounting-trial-balance-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  padding: 9px 10px 10px;
  align-items: end;
}

.accounting-trial-balance-filter-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.accounting-trial-balance-filter-grid label > span {
  color: #5b716a;
  font-size: .59rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.accounting-trial-balance-filter-grid input {
  width: 100%;
  min-height: 33px;
  padding: 6px 9px;
  border: 1px solid #cad9d3;
  border-radius: 9px;
  background: #fff;
  color: #203b34;
  font: inherit;
  font-size: .72rem;
}

.accounting-trial-balance-filter-grid input:focus {
  border-color: #858d90;
  outline: 3px solid rgba(245, 159, 47, .12);
}

.accounting-trial-balance-filter-grid .accounting-imputation-account-search > input {
  min-height: 34px;
  padding-left: 30px;
}

.accounting-trial-balance-lookup-end .accounting-imputation-account-popover {
  right: 0;
  left: auto;
}

.accounting-trial-balance-filter-grid .accounting-imputation-account-control {
  min-height: 33px;
}

.accounting-trial-balance-cost-center {
  grid-column: span 2;
}

.accounting-trial-balance-evolution-toggle {
  display: flex !important;
  grid-column: span 2;
  min-height: 33px;
  flex-direction: row !important;
  align-items: center;
  gap: 9px !important;
  padding: 6px 9px;
  border: 1px solid #cad9d3;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.accounting-trial-balance-evolution-toggle > input[type="checkbox"] {
  width: 16px !important;
  min-width: 16px;
  height: 16px;
  min-height: 16px !important;
  margin: 0;
  padding: 0 !important;
  accent-color: #17634f;
  cursor: pointer;
}

.accounting-trial-balance-evolution-toggle > .accounting-trial-balance-evolution-copy {
  display: grid;
  gap: 1px;
  color: #314d45;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.12;
  text-transform: none;
}

.accounting-trial-balance-evolution-copy strong {
  font-size: .69rem;
  font-weight: 900;
}

.accounting-trial-balance-evolution-copy small {
  color: #70827c;
  font-size: .59rem;
  font-weight: 600;
}

.accounting-trial-balance-table-area {
  min-height: 0;
}

.accounting-trial-balance-table {
  min-width: 760px;
  font-variant-numeric: tabular-nums;
}

.accounting-trial-balance-table th:nth-child(1),
.accounting-trial-balance-table td:nth-child(1) {
  width: 16%;
  white-space: nowrap;
}

.accounting-trial-balance-table th:nth-child(2),
.accounting-trial-balance-table td:nth-child(2) {
  width: 34%;
}

.accounting-trial-balance-table th:nth-child(n+3),
.accounting-trial-balance-table td:nth-child(n+3) {
  width: 16.66%;
}

.accounting-trial-balance-table td.is-negative,
.accounting-trial-balance-table tfoot .is-negative {
  color: #9b3d32;
  font-weight: 800;
}

.accounting-trial-balance-table.is-evolution {
  width: max-content;
  min-width: 100%;
}

.accounting-trial-balance-table.is-evolution th:nth-child(1),
.accounting-trial-balance-table.is-evolution td:nth-child(1) {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
}

.accounting-trial-balance-table.is-evolution th:nth-child(2),
.accounting-trial-balance-table.is-evolution td:nth-child(2) {
  width: 250px;
  min-width: 250px;
  max-width: 250px;
}

.accounting-trial-balance-table.is-evolution th:nth-child(n+3),
.accounting-trial-balance-table.is-evolution td:nth-child(n+3) {
  width: 138px;
  min-width: 138px;
  max-width: 138px;
}

.accounting-trial-balance-table.is-evolution thead th:nth-child(n+3) {
  text-align: right;
}

.accounting-trial-balance-pagination {
  margin-top: 7px;
}

.accounting-trial-balance-card:not(.is-widget-maximized) .accounting-trial-balance-table-area {
  padding-bottom: 4px;
}

.accounting-trial-balance-card:not(.is-widget-maximized) .accounting-trial-balance-table-wrap {
  max-height: 182px;
}

/* Al volver de la vista maximizada, el estado colapsado del filtro puede
   conservarse. En la tarjeta compacta no debe agrandar la tabla porque
   terminaría invadiendo el padding inferior del card. */
.accounting-trial-balance-card.is-filter-collapsed:not(.is-widget-maximized) .accounting-trial-balance-table-wrap {
  max-height: 182px;
}

.accounting-trial-balance-card:not(.is-widget-maximized) .accounting-trial-balance-pagination {
  display: none;
}

.accounting-trial-balance-card:not(.is-widget-maximized) .accounting-trial-balance-table {
  min-width: 660px;
  font-size: .63rem;
}

.accounting-trial-balance-card:not(.is-widget-maximized) .accounting-trial-balance-table th,
.accounting-trial-balance-card:not(.is-widget-maximized) .accounting-trial-balance-table td {
  padding: 5px 6px;
}

.accounting-trial-balance-card.is-widget-maximized {
  display: flex;
  flex-direction: column;
}

.accounting-trial-balance-card.is-widget-maximized .accounting-trial-balance-table-area {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.accounting-trial-balance-card.is-widget-maximized .accounting-trial-balance-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.dashboard-theme .accounting-trial-balance-filter-toolbar {
  border-color: #d9ddda;
}

.dashboard-theme .accounting-trial-balance-filter-grid label > span {
  color: #606a70;
}

.dashboard-theme .accounting-trial-balance-filter-grid input {
  border-color: #cfd4d1;
  color: #263136;
}

@media (max-width: 1180px) {
  .accounting-trial-balance-filter-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

@media (max-width: 760px) {
  .accounting-trial-balance-filter-toolbar {
    grid-template-columns: 1fr;
  }


  .accounting-trial-balance-filter-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 520px) {
  .accounting-trial-balance-filter-grid {
    grid-template-columns: 1fr;
  }

  .accounting-trial-balance-cost-center,
  .accounting-trial-balance-evolution-toggle {
    grid-column: auto;
  }

  .accounting-trial-balance-lookup-end .accounting-imputation-account-popover {
    right: auto;
    left: 0;
  }
}

/* ========================================================================== */
/* Contabilidad General — acceso al Mayor de Cuenta desde Balance             */
/* ========================================================================== */
.accounting-trial-balance-account-cell {
  position: relative;
}

.accounting-trial-balance-account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 1px 4px 1px 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 760;
  line-height: 1.25;
  cursor: pointer;
}

.accounting-trial-balance-account-trigger:hover,
.accounting-trial-balance-account-trigger[aria-expanded="true"] {
  color: #8b560f;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.accounting-trial-balance-account-trigger:focus-visible {
  outline: 2px solid rgba(245, 159, 47, .32);
  outline-offset: 2px;
}

.accounting-trial-balance-account-chevron {
  flex: 0 0 auto;
  color: #8a9296;
  font-size: .72em;
  line-height: 1;
  transform: translateY(-1px);
}

.accounting-trial-balance-account-menu {
  position: fixed;
  z-index: 15100;
  width: 232px;
  padding: 5px;
  border: 1px solid rgba(17, 28, 34, .14);
  border-radius: 11px;
  background: #fffefa;
  box-shadow: 0 16px 42px rgba(8, 15, 18, .20);
}

.accounting-trial-balance-account-menu[hidden] {
  display: none !important;
}

.accounting-trial-balance-account-menu > button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #202b30;
  text-align: left;
  cursor: pointer;
}

.accounting-trial-balance-account-menu > button:hover,
.accounting-trial-balance-account-menu > button:focus-visible {
  background: #f1f3f1;
  outline: none;
}

.accounting-trial-balance-account-menu > button > span:last-child {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.accounting-trial-balance-account-menu strong {
  font-size: .72rem;
  font-weight: 900;
}

.accounting-trial-balance-account-menu small {
  color: #717b80;
  font-size: .61rem;
  font-weight: 650;
}

body.accounting-ledger-open {
  overflow: hidden;
}

.accounting-ledger-backdrop {
  position: fixed;
  z-index: 15200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 12, 14, .62);
}

.accounting-ledger-backdrop[hidden] {
  display: none !important;
}

.accounting-ledger-dialog {
  display: flex;
  flex-direction: column;
  width: min(1320px, calc(100vw - 36px));
  max-height: min(850px, calc(100dvh - 36px));
  overflow: hidden;
  border: 1px solid rgba(245, 159, 47, .30);
  border-radius: 18px;
  background: #fbfbf8;
  box-shadow: 0 34px 96px rgba(4, 10, 12, .42);
  outline: none;
}

.accounting-ledger-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  padding: 15px 17px 12px;
  border-bottom: 1px solid #dde1df;
}

.accounting-ledger-heading-copy {
  min-width: 0;
}

.accounting-ledger-header .eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #b66d13;
  font-size: .61rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.accounting-ledger-header h2 {
  margin: 0;
  overflow: hidden;
  color: #171f24;
  font-size: 1.08rem;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-ledger-header p {
  margin: 3px 0 0;
  color: #737d82;
  font-size: .68rem;
}

.accounting-ledger-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.accounting-ledger-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 560px) auto auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 9px 17px;
  border-bottom: 1px solid #e1e5e3;
  background: #f5f6f3;
}

.accounting-ledger-search {
  position: relative;
  display: block;
  min-width: 0;
}

.accounting-ledger-search .ui-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 10px;
  width: 13px;
  height: 13px;
  color: #68747a;
  transform: translateY(-50%);
  pointer-events: none;
}

.accounting-ledger-search input {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px 6px 31px;
  border: 1px solid #cfd5d2;
  border-radius: 9px;
  background: #fff;
  color: #273237;
  font: inherit;
  font-size: .72rem;
}

.accounting-ledger-search input:focus {
  border-color: #9b7a49;
  outline: 3px solid rgba(245, 159, 47, .12);
}

.accounting-ledger-manual-toggle {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid #cfd5d2;
  border-radius: 9px;
  background: #fff;
  color: #3f4b50;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.accounting-ledger-manual-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #17634f;
  cursor: pointer;
}

.accounting-ledger-manual-toggle:focus-within {
  border-color: #9b7a49;
  outline: 3px solid rgba(245, 159, 47, .12);
}

.accounting-ledger-count {
  color: #606b70;
  font-size: .67rem;
  font-weight: 800;
  white-space: nowrap;
}

.accounting-ledger-state {
  flex: 0 0 auto;
  margin: 10px 17px 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: #eef1ef;
  color: #4f5e64;
  font-size: .69rem;
}

.accounting-ledger-state[data-state="error"] {
  background: #fff0ed;
  color: #9b3d32;
}

.accounting-ledger-content {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 9px;
  padding: 10px 17px 14px;
}

.accounting-ledger-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  flex: 0 0 auto;
}

.accounting-ledger-summary > span {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 47px;
  padding: 7px 9px;
  border: 1px solid #dce1de;
  border-radius: 9px;
  background: #f6f7f5;
}

.accounting-ledger-summary small {
  color: #768086;
  font-size: .55rem;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.accounting-ledger-summary strong {
  overflow: hidden;
  color: #253137;
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-ledger-summary strong.is-negative {
  color: #9b3d32;
}

.accounting-ledger-table-wrap {
  flex: 1 1 auto;
  min-height: 260px;
  overflow: auto;
  border: 1px solid #d8ddda;
  border-radius: 10px;
  background: #fff;
}

.accounting-ledger-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  color: #29363b;
  font-size: .66rem;
  font-variant-numeric: tabular-nums;
}

.accounting-ledger-table th,
.accounting-ledger-table td {
  padding: 6px 7px;
  border-bottom: 1px solid #e5e8e6;
  vertical-align: middle;
}

.accounting-ledger-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #111c22;
  color: #fff;
  font-size: .56rem;
  font-weight: 900;
  letter-spacing: .015em;
  text-transform: uppercase;
  white-space: nowrap;
}

.accounting-ledger-table th:nth-child(1),
.accounting-ledger-table td:nth-child(1),
.accounting-ledger-table th:nth-child(2),
.accounting-ledger-table td:nth-child(2),
.accounting-ledger-table th:nth-child(4),
.accounting-ledger-table td:nth-child(4),
.accounting-ledger-table th:nth-child(5),
.accounting-ledger-table td:nth-child(5),
.accounting-ledger-table th:nth-child(6),
.accounting-ledger-table td:nth-child(6) {
  white-space: nowrap;
}

.accounting-ledger-table th:nth-child(7),
.accounting-ledger-table td:nth-child(7) {
  min-width: 260px;
}

.accounting-ledger-table .number-cell {
  text-align: right;
  white-space: nowrap;
}

.accounting-ledger-table td.is-negative {
  color: #9b3d32;
  font-weight: 800;
}

.accounting-ledger-empty td {
  padding: 22px 12px;
  color: #778186;
  text-align: center;
}

.accounting-ledger-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 31px;
  color: #606a70;
  font-size: .65rem;
  font-weight: 800;
}

@media (max-width: 820px) {
  .accounting-ledger-backdrop {
    padding: 8px;
  }

  .accounting-ledger-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }

  .accounting-ledger-header,
  .accounting-ledger-toolbar,
  .accounting-ledger-content {
    padding-inline: 11px;
  }

  .accounting-ledger-header {
    align-items: stretch;
    flex-direction: column;
  }

  .accounting-ledger-header-actions {
    justify-content: flex-end;
  }

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

  .accounting-ledger-manual-toggle {
    justify-self: start;
  }

  .accounting-ledger-count {
    justify-self: end;
  }

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

@media (max-width: 480px) {
  .accounting-ledger-summary {
    grid-template-columns: 1fr;
  }
}

/* Período contable global: reutiliza el mismo drawer compacto de filtros del dashboard. */
.accounting-period-filter {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0 0 10px;
}

.accounting-period-filter-body {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.accounting-period-filter-group {
  grid-column: span 4;
  margin: 0;
  padding: 9px 10px;
}

.accounting-period-filter-group .filter-heading {
  margin-bottom: 5px;
}

.accounting-period-filter-group .filter-select {
  width: 100%;
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.accounting-period-filter-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: .67rem;
  font-weight: 700;
  line-height: 1.35;
}

.accounting-period-filter-state {
  grid-column: span 8;
  align-self: stretch;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid rgba(16, 18, 23, .10);
  border-radius: 14px;
  color: #516169;
  background: rgba(255, 255, 255, .54);
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.35;
}

.accounting-period-filter-state[hidden] {
  display: none;
}

.accounting-period-filter-state.is-error {
  border-color: rgba(186, 73, 56, .24);
  color: #9e3d31;
  background: #fff4f1;
}

.accounting-period-filter .filter-summary-chips b {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-imputation-filter-grid input[type="date"]:disabled,
.accounting-trial-balance-filter-grid input[type="date"]:disabled {
  opacity: 1;
  cursor: not-allowed;
  border-color: #d4dfdb;
  background: #f3f6f5;
  color: #50645d;
  -webkit-text-fill-color: #50645d;
}

@media (max-width: 1220px) {
  .accounting-period-filter-group {
    grid-column: span 6;
  }

  .accounting-period-filter-state {
    grid-column: span 6;
  }
}

@media (max-width: 760px) {
  .accounting-period-filter {
    margin-bottom: 8px;
  }

  .accounting-period-filter-group,
  .accounting-period-filter-state {
    grid-column: 1 / -1;
  }
}

/* ========================================================================== */
/* Contabilidad General — indicadores y gráficos de lectura rápida            */
/* ========================================================================== */
.accounting-overview-kpis,
.accounting-overview-grid,
.accounting-overview-state {
  grid-column: 1 / -1;
}

.accounting-overview-kpis {
  margin-bottom: 0;
}

.accounting-overview-kpis .kpi-card {
  min-width: 0;
}

.accounting-overview-kpi-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.accounting-overview-grid {
  margin: 0;
}

.accounting-overview-chart-card {
  min-width: 0;
}

.accounting-overview-chart-card .card-heading {
  min-height: 76px;
}

.accounting-overview-chart-card canvas {
  height: 270px !important;
}

.accounting-overview-chart-body {
  position: relative;
  min-height: 270px;
}

.accounting-overview-chart-body > canvas[hidden] {
  display: none !important;
}

.accounting-overview-empty {
  min-height: 270px;
  display: grid;
  place-items: center;
  margin: 0;
  text-align: center;
}

.accounting-overview-empty[hidden] {
  display: none;
}

.accounting-overview-state {
  min-height: 20px;
  margin: -2px 2px 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}

.accounting-overview-state:empty,
.accounting-overview-state[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .accounting-overview-chart-card canvas,
  .accounting-overview-chart-body,
  .accounting-overview-empty {
    min-height: 235px;
    height: 235px !important;
  }
}

/* Contabilidad General — KPIs compactos alineados con Cuentas Corrientes */
.dashboard-theme .accounting-overview-kpis.customer-account-kpi-grid {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 0;
}

.dashboard-theme .accounting-overview-kpis .customer-account-kpi {
  min-height: 86px;
  padding: 11px 13px;
  border-radius: 15px;
}

.dashboard-theme .accounting-overview-kpis .accounting-overview-kpi-text {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Los gráficos de lectura rápida quedan después de los dos listados contables. */
.dashboard-theme .accounting-overview-grid {
  grid-column: 1 / -1;
  margin-top: 0;
}

@media (max-width: 1220px) {
  .dashboard-theme .accounting-overview-kpis.customer-account-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-theme .accounting-overview-kpis.customer-account-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .dashboard-theme .accounting-overview-kpis .customer-account-kpi {
    min-height: 78px;
    padding: 9px 10px;
  }
}

@media (max-width: 520px) {
  .dashboard-theme .accounting-overview-kpis.customer-account-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================================== */
/* Contabilidad General — ajuste compacto de gráficos y cabeceras              */
/* ========================================================================== */
.dashboard-theme .accounting-overview-grid {
  align-items: stretch;
  grid-auto-rows: 288px;
  gap: 12px;
}

.dashboard-theme .accounting-overview-chart-card {
  box-sizing: border-box;
  height: 288px;
  min-height: 288px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-theme .accounting-overview-chart-card > .card-heading {
  min-height: 0;
  margin-bottom: 6px;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: flex-start;
}

.dashboard-theme .accounting-overview-chart-card.has-widget-controls > .card-heading {
  padding-right: 116px;
}

.dashboard-theme .accounting-overview-chart-card > .card-heading > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.dashboard-theme .accounting-overview-chart-card > .card-heading h2 {
  font-size: 1rem;
  line-height: 1.08;
}

.dashboard-theme .accounting-overview-chart-card > .card-heading .chart-insight {
  margin-top: 3px;
  font-size: .68rem;
  line-height: 1.22;
}

.dashboard-theme .accounting-overview-chart-card > .card-heading > .metric-chip {
  flex: 0 0 auto;
  min-height: 24px;
  margin-left: auto;
  padding: 4px 8px;
  font-size: .60rem;
  white-space: nowrap;
}

.dashboard-theme .accounting-overview-chart-card > .card-heading > .widget-control-group {
  gap: 8px;
}

.dashboard-theme .accounting-overview-chart-body {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

.dashboard-theme .accounting-overview-chart-card canvas,
.dashboard-theme .accounting-overview-chart-body > canvas {
  min-height: 0 !important;
  height: 100% !important;
  max-height: 198px !important;
}

.dashboard-theme .accounting-overview-empty {
  min-height: 0;
  height: 100% !important;
  padding: 12px;
}

/* En el KPI de mayor variación, el importe es el dato principal y la cuenta
   queda como contexto en una línea secundaria truncable. */
.dashboard-theme .accounting-overview-kpis [data-widget-id="accounting-greatest-variation"] .customer-account-kpi-copy {
  min-width: 0;
  overflow: hidden;
}

.dashboard-theme .accounting-overview-kpis [data-widget-id="accounting-greatest-variation"] .accounting-overview-kpi-text {
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-theme .accounting-overview-kpis [data-widget-id="accounting-greatest-variation"] [data-accounting-overview-greatest-note] {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1220px) {
  .dashboard-theme .accounting-overview-grid {
    grid-auto-rows: auto;
  }

  .dashboard-theme .accounting-overview-chart-card {
    height: 276px;
    min-height: 276px;
  }

  .dashboard-theme .accounting-overview-chart-card canvas,
  .dashboard-theme .accounting-overview-chart-body > canvas {
    max-height: 186px !important;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .accounting-overview-chart-card {
    height: auto;
    min-height: 258px;
  }

  .dashboard-theme .accounting-overview-chart-card.has-widget-controls > .card-heading {
    padding-right: 108px;
    flex-wrap: wrap;
  }

  .dashboard-theme .accounting-overview-chart-card > .card-heading > .metric-chip {
    margin-left: 0;
  }

  .dashboard-theme .accounting-overview-chart-card canvas,
  .dashboard-theme .accounting-overview-chart-body > canvas,
  .dashboard-theme .accounting-overview-empty {
    height: 178px !important;
    max-height: 178px !important;
  }
}

/* ========================================================================== */
/* Contabilidad General — aprovechar el alto disponible en los gráficos       */
/* ========================================================================== */
/*
   En escritorio los dos cards inferiores crecen en conjunto para ocupar el
   espacio libre que quedaba al pie de la pantalla, manteniendo exactamente la
   misma altura entre sí. El cuerpo del gráfico acompaña el crecimiento para
   evitar dejar aire interno innecesario.
*/
.dashboard-theme .accounting-overview-grid {
  grid-auto-rows: 360px;
}

.dashboard-theme .accounting-overview-chart-card {
  height: 360px;
  min-height: 360px;
}

.dashboard-theme .accounting-overview-chart-card canvas,
.dashboard-theme .accounting-overview-chart-body > canvas {
  max-height: 270px !important;
}

@media (max-width: 1220px) {
  .dashboard-theme .accounting-overview-grid {
    grid-auto-rows: auto;
  }

  .dashboard-theme .accounting-overview-chart-card {
    height: 320px;
    min-height: 320px;
  }

  .dashboard-theme .accounting-overview-chart-card canvas,
  .dashboard-theme .accounting-overview-chart-body > canvas {
    max-height: 230px !important;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .accounting-overview-chart-card {
    height: auto;
    min-height: 258px;
  }

  .dashboard-theme .accounting-overview-chart-card canvas,
  .dashboard-theme .accounting-overview-chart-body > canvas,
  .dashboard-theme .accounting-overview-empty {
    height: 178px !important;
    max-height: 178px !important;
  }
}

/* Mayor de cuenta -> detalle del asiento: el modal de asiento debe quedar
   por encima del mayor cuando ambos están abiertos. */
body.accounting-ledger-open.accounting-journal-entry-open .accounting-journal-entry-backdrop {
  z-index: 15300;
}

/* ========================================================================== */
/* Impuestos — cards alineadas con Contabilidad General                       */
/* ========================================================================== */
.dashboard-theme .tax-dashboard {
  min-width: 0;
}

.dashboard-theme .tax-antiforgery {
  display: none;
}

.dashboard-theme .tax-report-card {
  position: relative;
}

.dashboard-theme .tax-report-heading {
  min-height: 52px;
}

.dashboard-theme .tax-report-heading .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dashboard-theme .tax-report-heading .eyebrow .ui-icon {
  width: 13px;
  height: 13px;
}

.dashboard-theme .tax-report-status[data-state="loading"] {
  background: #fff4d9;
  color: #835a0a;
}

.dashboard-theme .tax-report-status[data-state="error"] {
  background: #fff0ed;
  color: #a13c2d;
}

.dashboard-theme .tax-report-status[data-state="empty"] {
  background: #f0f3f1;
  color: #62736d;
}

.dashboard-theme .tax-report-status[data-state="idle"] {
  background: #f0f3f1;
  color: #62736d;
}

.dashboard-theme .tax-report-status[data-state="invalid"] {
  background: #fff0ed;
  color: #a13c2d;
}

.dashboard-theme .tax-vat-period-form {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid #d7e5df;
  border-radius: 12px;
  background: #f5faf7;
}

.dashboard-theme .tax-vat-period-fields {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.dashboard-theme .tax-vat-period-fields label {
  display: grid;
  gap: 3px;
}

.dashboard-theme .tax-vat-period-fields label > span {
  color: #60736d;
  font-size: .56rem;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.dashboard-theme .tax-vat-period-fields input {
  min-height: 31px;
  padding: 5px 8px;
  border: 1px solid #cad9d3;
  border-radius: 8px;
  background: #fff;
  color: #203b34;
  font: inherit;
  font-size: .69rem;
  font-weight: 750;
}

.dashboard-theme .tax-vat-period-fields input:focus {
  border-color: #58a58d;
  outline: 3px solid rgba(38, 139, 107, .1);
}

.dashboard-theme .tax-vat-period-fields input[aria-invalid="true"] {
  border-color: #c86d5d;
}

.dashboard-theme .tax-vat-period-arrow {
  padding-bottom: 8px;
  color: #779087;
  font-weight: 900;
}

.dashboard-theme .tax-date-validation {
  max-width: 340px;
  color: #a13c2d;
  font-size: .64rem;
  font-weight: 750;
  text-align: right;
}

.dashboard-theme .tax-date-validation:empty {
  display: none;
}

.dashboard-theme .tax-report-preview {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) minmax(150px, .68fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 10px 13px;
  min-height: 142px;
  padding: 16px 18px 12px;
  border: 1px solid #dbe5e1;
  border-radius: 13px;
  background: linear-gradient(145deg, #fff, #f6faf8);
}

.dashboard-theme .tax-vat-preview {
  grid-template-columns: minmax(0, 1fr) minmax(165px, .52fr);
  grid-template-rows: 1fr auto;
}

.dashboard-theme .tax-vat-preview-hero {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-content: center;
  gap: 4px 13px;
  min-width: 0;
}

.dashboard-theme .tax-vat-preview-hero .tax-report-preview-icon {
  grid-row: 1 / 3;
}

.dashboard-theme .tax-vat-preview .tax-vat-preview-position {
  grid-column: 1 / -1;
  margin-top: 8px;
  color: #17302a;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
}

.dashboard-theme .tax-vat-preview-hero em {
  grid-column: 1 / -1;
  color: #835a0a;
  font-size: .61rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .04em;
}

.dashboard-theme .tax-vat-report-card.is-taxpayer-credit .tax-vat-preview-hero em {
  color: #17634f;
}

.dashboard-theme .tax-vat-preview .tax-report-preview-metrics {
  grid-template-columns: 1fr;
  align-content: center;
}

.dashboard-theme .tax-vat-preview .tax-report-preview-hint {
  grid-column: 1 / -1;
}


/* The compact IVA card mirrors the ERP ledger rather than reducing it to a
   single net figure. Each column keeps its fiscal composition visible before
   the operator opens the complete workspace. */
.dashboard-theme .tax-vat-preview {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
  gap: 7px;
  padding: 10px 12px 8px;
}

.dashboard-theme .tax-vat-preview-heading {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.dashboard-theme .tax-vat-preview-heading .tax-report-preview-icon {
  grid-row: 1 / 3;
}

.dashboard-theme .tax-vat-preview-heading em {
  grid-column: 2 / -1;
  color: #835a0a;
  font-size: .58rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .04em;
}

.dashboard-theme .tax-vat-report-card.is-taxpayer-credit .tax-vat-preview-heading em,
.dashboard-theme .tax-vat-report-card.is-taxpayer-credit .tax-vat-compact-position em {
  color: #17634f;
}

.dashboard-theme .tax-vat-compact-ledger {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.dashboard-theme .tax-vat-compact-section {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid #dce8e3;
  border-radius: 10px;
  background: rgba(255, 255, 255, .76);
}

.dashboard-theme .tax-vat-compact-section > strong {
  display: block;
  margin-bottom: 2px;
  color: #42645a;
  font-size: .56rem;
  font-weight: 950;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.dashboard-theme .tax-vat-compact-section dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.dashboard-theme .tax-vat-compact-section dl > div {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(215, 229, 223, .72);
}

.dashboard-theme .tax-vat-compact-section dl > div:last-child {
  border-bottom: 0;
}

.dashboard-theme .tax-vat-compact-section dt {
  min-width: 0;
  overflow: hidden;
  color: #6d7f79;
  font-size: .54rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .tax-vat-compact-section dd {
  margin: 0;
  overflow: hidden;
  color: #203b34;
  font-size: .58rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .tax-vat-compact-section .is-total {
  margin-top: 2px;
  padding-top: 4px;
}

.dashboard-theme .tax-vat-compact-section .is-total :is(dt, dd) {
  color: #17302a;
  font-size: .62rem;
  font-weight: 950;
}

.dashboard-theme .tax-vat-compact-position {
  border-color: #c9e0d5;
  background: linear-gradient(145deg, #fff, #eaf6f0);
}

.dashboard-theme .tax-vat-compact-position dd {
  font-size: .74rem;
  letter-spacing: -.025em;
}

.dashboard-theme .tax-vat-compact-position em {
  display: block;
  margin-top: 5px;
  color: #835a0a;
  font-size: .54rem;
  font-style: normal;
  font-weight: 950;
  letter-spacing: .045em;
}

.dashboard-theme .tax-report-preview-icon {
  width: 34px;
  height: 34px;
  color: #1f6b58;
}

.dashboard-theme .tax-report-preview-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.dashboard-theme .tax-report-preview strong {
  color: #17302a;
  font-size: .88rem;
  font-weight: 900;
}

.dashboard-theme .tax-report-preview p {
  max-width: 36rem;
  margin: 0;
  color: #6d7f79;
  font-size: .66rem;
  font-weight: 650;
  line-height: 1.38;
}

.dashboard-theme .tax-report-preview-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  min-width: 0;
}

.dashboard-theme .tax-report-preview-metrics > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dashboard-theme .tax-report-preview-metrics small {
  color: #6d7f79;
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.dashboard-theme .tax-report-preview-metrics :is(strong, b) {
  overflow: hidden;
  color: #17302a;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .tax-report-preview-metrics strong {
  font-size: .98rem;
  font-weight: 950;
}

.dashboard-theme .tax-report-preview-metrics b {
  font-weight: 850;
}

.dashboard-theme .tax-report-preview-metrics em {
  grid-column: 1 / -1;
  color: #3d665a;
  font-size: .61rem;
  font-style: normal;
  font-weight: 850;
}

.dashboard-theme .tax-report-card[data-tax-state="error"] .tax-report-preview-metrics em {
  color: #a13c2d;
}

.dashboard-theme .tax-report-preview-hint {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid #e1e9e5;
  color: #3d665a;
  font-size: .62rem;
  font-weight: 850;
}

.dashboard-theme .tax-report-preview-hint .ui-icon {
  width: 13px;
  height: 13px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-workspace {
  display: none !important;
}

.dashboard-theme .tax-report-card.is-widget-maximized .tax-report-preview {
  display: none;
}

.dashboard-theme .tax-report-card.is-widget-maximized .tax-report-workspace {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.dashboard-theme .tax-query-section,
.dashboard-theme .tax-table-section,
.dashboard-theme .tax-vat-card {
  min-width: 0;
  border: 1px solid #d7e5df;
  border-radius: 13px;
  background: #fff;
}

.dashboard-theme .tax-query-section {
  padding: 10px;
  background: #eef6f2;
}

.dashboard-theme .tax-query-card-heading,
.dashboard-theme .tax-table-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-theme .tax-query-card-heading h3,
.dashboard-theme .tax-table-heading h3 {
  margin: 2px 0 0;
  color: #17302a;
  font-size: .86rem;
  line-height: 1.18;
}

.dashboard-theme .tax-query-card-heading p {
  max-width: 780px;
  margin: 3px 0 0;
  color: #6d7f79;
  font-size: .64rem;
  font-weight: 650;
  line-height: 1.32;
}

.dashboard-theme .tax-filter-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 230px)) auto;
  align-items: end;
  gap: 8px;
  margin-top: 9px;
}

.dashboard-theme .tax-filter-form-iibb {
  grid-template-columns: minmax(170px, 230px) repeat(2, minmax(150px, 220px)) auto;
}

.dashboard-theme .tax-filter-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-theme .tax-filter-form label > span {
  color: #5b716a;
  font-size: .59rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.dashboard-theme .tax-filter-form :is(input, select) {
  width: 100%;
  min-height: 33px;
  padding: 6px 9px;
  border: 1px solid #cad9d3;
  border-radius: 9px;
  background: #fff;
  color: #203b34;
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
}

.dashboard-theme .tax-filter-form :is(input, select):focus {
  border-color: #58a58d;
  outline: 3px solid rgba(38, 139, 107, .1);
}

.dashboard-theme .tax-filter-form .primary-button {
  min-height: 33px;
  padding: 6px 12px;
  border-radius: 9px;
  font-size: .69rem;
}

.dashboard-theme .tax-query-state {
  min-height: 18px;
  margin-top: 7px;
  color: #60736d;
  font-size: .66rem;
  font-weight: 700;
}

.dashboard-theme .tax-query-state[data-state="loading"] {
  color: #835a0a;
}

.dashboard-theme .tax-query-state[data-state="error"] {
  color: #a13c2d;
}

.dashboard-theme .tax-query-state[data-state="invalid"] {
  color: #a13c2d;
}

.dashboard-theme .tax-vat-query-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 9px;
  background: #f3f7f5;
}

/* The compact IVA card is a fiscal summary, not a query console. Query feedback
   remains available in the modal; keeping it here used a whole row and forced
   the ledger below the card's fixed compact height. */
.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-query-state {
  display: none;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  align-content: center;
  gap: 8px;
  padding: 8px 12px 10px;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-heading {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-heading .tax-report-preview-icon {
  width: 30px;
  height: 30px;
  grid-row: auto;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-report-preview-copy {
  gap: 2px;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-report-preview-copy strong {
  font-size: .82rem;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-report-preview-copy p {
  font-size: .58rem;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-ledger {
  grid-template-columns: minmax(0, .95fr) minmax(0, .95fr) minmax(0, 1.1fr);
  align-items: stretch;
  gap: 8px;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 102px;
  padding: 7px 9px;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-position {
  justify-content: center;
}

.dashboard-theme .tax-vat-report-card.is-widget-maximized .tax-report-workspace {
  grid-template-rows: minmax(0, 1fr);
}

.dashboard-theme .tax-vat-query-state .ghost-button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 10px;
  font-size: .65rem;
}

.dashboard-theme .tax-query-state[data-state="empty"] {
  color: #62736d;
}

.dashboard-theme .tax-query-state[data-state="success"] {
  color: #17634f;
}

.dashboard-theme .tax-vat-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(260px, .86fr);
  gap: 10px;
  min-height: 0;
}

.dashboard-theme .tax-vat-results[hidden] {
  display: none;
}

.dashboard-theme .tax-vat-card {
  padding: 13px;
  box-shadow: 0 8px 20px rgba(20, 45, 38, .045);
}

.dashboard-theme .tax-vat-card-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid #e2eae6;
}

.dashboard-theme .tax-vat-card-heading > .ui-icon {
  width: 18px;
  height: 18px;
  color: #1f6b58;
}

.dashboard-theme .tax-vat-card-heading div {
  display: grid;
  gap: 1px;
}

.dashboard-theme .tax-vat-card-heading span {
  color: #6b7e77;
  font-size: .56rem;
  font-weight: 950;
  letter-spacing: .08em;
}

.dashboard-theme .tax-vat-card-heading strong {
  color: #203b34;
  font-size: .8rem;
}

.dashboard-theme .tax-value-list {
  display: grid;
  gap: 0;
  margin: 5px 0 0;
}

.dashboard-theme .tax-value-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid #e9efec;
}

.dashboard-theme .tax-value-list > div:last-child {
  border-bottom: 0;
}

.dashboard-theme .tax-value-list dt {
  color: #60736d;
  font-size: .68rem;
  font-weight: 750;
}

.dashboard-theme .tax-value-list dd {
  margin: 0;
  color: #203b34;
  font-size: .78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dashboard-theme .tax-value-list .is-total {
  margin-top: 2px;
  padding-top: 9px;
}

.dashboard-theme .tax-value-list .is-total :is(dt, dd) {
  color: #17302a;
  font-size: .84rem;
  font-weight: 950;
}

.dashboard-theme .tax-vat-position-card {
  display: flex;
  flex-direction: column;
  border-color: #d7e5df;
  background: linear-gradient(145deg, #fff, #eef7f3);
}

.dashboard-theme .tax-position-value {
  margin-top: auto;
  padding-top: 20px;
  color: #17302a;
  font-size: clamp(1.55rem, 2.7vw, 2.35rem);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
}

.dashboard-theme .tax-position-status {
  margin-top: 5px;
  color: #835a0a;
  font-size: .68rem;
  font-weight: 950;
  letter-spacing: .06em;
}

.dashboard-theme .tax-vat-position-card.is-taxpayer-credit {
  border-color: #badacc;
  background: linear-gradient(145deg, #fff, #e8f5ef);
}

.dashboard-theme .tax-vat-position-card.is-taxpayer-credit .tax-position-status {
  color: #17634f;
}

.dashboard-theme .tax-vat-position-card.is-tax-authority .tax-position-status {
  color: #835a0a;
}

.dashboard-theme .tax-table-section {
  min-height: 0;
  padding: 10px;
  overflow: hidden;
}

.dashboard-theme .tax-table-section[hidden] {
  display: none;
}

.dashboard-theme .tax-table-heading {
  align-items: center;
  margin-bottom: 7px;
}

.dashboard-theme .tax-table-heading > span {
  color: #60736d;
  font-size: .66rem;
  font-weight: 850;
}

.dashboard-theme .tax-table-wrap {
  max-width: 100%;
  max-height: calc(100dvh - 245px);
  overflow: auto;
  border: 1px solid var(--data-table-frame, #d9ddda);
  border-radius: 11px;
  background: #fff;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.dashboard-theme .tax-data-table {
  width: 100%;
  min-width: 1460px;
  table-layout: auto;
  font-size: .69rem;
}

.dashboard-theme .tax-data-table th,
.dashboard-theme .tax-data-table td {
  padding: 7px 8px;
  white-space: nowrap;
}

.dashboard-theme .tax-data-table th:nth-child(2),
.dashboard-theme .tax-data-table td:nth-child(2) {
  min-width: 230px;
}

.dashboard-theme .tax-data-table th:nth-child(3),
.dashboard-theme .tax-data-table td:nth-child(3) {
  min-width: 230px;
}

.dashboard-theme .tax-data-table th:nth-child(7),
.dashboard-theme .tax-data-table td:nth-child(7) {
  min-width: 190px;
}

.dashboard-theme .tax-data-table tbody td {
  border-bottom: 1px solid var(--data-table-line, #e5e8e6);
  background: #fff;
  color: var(--data-table-text, #2e373b);
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-theme .tax-data-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-theme .tax-export-button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-export-button {
  display: none !important;
}

@media (max-width: 760px) {
  .dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-ledger {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-section {
    min-height: 0;
  }

  .dashboard-theme .tax-vat-compact-ledger {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .tax-vat-preview-heading {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .dashboard-theme .tax-vat-preview-heading em {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1180px) {
  .dashboard-theme .tax-vat-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .tax-vat-position-card {
    grid-column: 1 / -1;
  }

  .dashboard-theme .tax-filter-form,
  .dashboard-theme .tax-filter-form-iibb {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .dashboard-theme .tax-report-card.is-widget-maximized .tax-report-workspace {
    grid-template-rows: auto minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .dashboard-theme .tax-report-heading {
    grid-template-columns: 1fr auto;
  }

  .dashboard-theme .tax-report-heading .accounting-imputation-heading-copy {
    grid-column: 1 / -1;
  }

  .dashboard-theme .tax-report-preview {
    grid-template-columns: 30px minmax(0, 1fr);
    min-height: 0;
    padding: 16px 14px 12px;
  }

  .dashboard-theme .tax-vat-period-form {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-theme .tax-vat-period-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .dashboard-theme .tax-vat-period-fields input {
    width: 100%;
    min-width: 0;
  }

  .dashboard-theme .tax-date-validation {
    max-width: none;
    text-align: left;
  }

  .dashboard-theme .tax-vat-preview {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .tax-vat-preview-hero,
  .dashboard-theme .tax-vat-preview .tax-report-preview-metrics {
    grid-column: 1 / -1;
  }

  .dashboard-theme .tax-vat-preview .tax-report-preview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .tax-report-preview-metrics {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-top: 9px;
    border-top: 1px solid #e1e9e5;
  }

  .dashboard-theme .tax-report-preview-metrics :is(strong, b) {
    font-size: .7rem;
    text-align: left;
  }

  .dashboard-theme .tax-report-preview-metrics strong {
    font-size: .86rem;
  }

  .dashboard-theme .tax-report-card.is-widget-maximized .tax-report-workspace {
    overflow: auto;
  }

  .dashboard-theme .tax-vat-results,
  .dashboard-theme .tax-filter-form,
  .dashboard-theme .tax-filter-form-iibb {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .tax-vat-position-card {
    grid-column: auto;
  }

  .dashboard-theme .tax-query-card-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-theme .tax-filter-form .primary-button {
    width: 100%;
  }

  .dashboard-theme .tax-table-wrap {
    max-height: calc(100dvh - 330px);
  }
}

@media (max-width: 480px) {
  .dashboard-theme .tax-report-preview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .tax-report-preview-metrics > span:first-child {
    grid-column: 1 / -1;
  }

  .dashboard-theme .tax-vat-preview .tax-report-preview-metrics > span:first-child {
    grid-column: auto;
  }
}

/* Impuestos — refinamiento de filtros automáticos, búsqueda y resumen compacto. */
.dashboard-theme .tax-query-section.accounting-imputation-filter-panel {
  padding: 0;
  overflow: hidden;
}

.dashboard-theme .tax-query-section.accounting-imputation-filter-panel.is-collapsed {
  background: #f5f6f3;
}

.dashboard-theme .tax-filter-toolbar {
  min-height: 42px;
}

.dashboard-theme .tax-filter-toolbar-no-search {
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-theme .tax-filter-body {
  padding: 7px 10px 9px;
  border-top: 1px solid #d9ddda;
}

.dashboard-theme .tax-query-section.is-collapsed .tax-filter-toolbar {
  min-height: 40px;
}

.dashboard-theme .tax-filter-form,
.dashboard-theme .tax-filter-form-iibb {
  align-items: end;
}

.dashboard-theme .tax-filter-form {
  grid-template-columns: repeat(2, minmax(150px, 230px));
}

.dashboard-theme .tax-filter-form-iibb {
  grid-template-columns: minmax(180px, 260px) repeat(2, minmax(150px, 230px));
}

.dashboard-theme .tax-vat-period-form {
  display: grid;
  justify-content: start;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dashboard-theme .tax-filter-form :is(input, select)[aria-invalid="true"] {
  border-color: #c86d5d;
  outline-color: rgba(200, 109, 93, .12);
}

.dashboard-theme .tax-report-search-field {
  min-width: 260px;
}

.dashboard-theme .tax-report-preview:not(.tax-vat-preview) {
  grid-template-rows: auto auto auto;
  min-height: 208px;
  align-content: center;
}

.dashboard-theme .tax-report-preview-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #e0e8e4;
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
}

.dashboard-theme .tax-report-preview-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #60736d;
  font-size: .54rem;
  font-weight: 900;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.dashboard-theme .tax-report-preview-list-heading small {
  color: #7a8782;
  font-size: .52rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
}

.dashboard-theme .tax-report-preview-list-rows {
  display: grid;
  gap: 3px;
}

.dashboard-theme .tax-report-preview-list-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) minmax(110px, auto);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-top: 4px;
  border-top: 1px solid #edf1ef;
}

.dashboard-theme .tax-report-preview-list-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.dashboard-theme .tax-report-preview-list-row > time {
  color: #5f706b;
  font-size: .58rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .tax-report-preview-list-copy {
  display: grid;
  min-width: 0;
}

.dashboard-theme .tax-report-preview-list-copy strong,
.dashboard-theme .tax-report-preview-list-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .tax-report-preview-list-copy strong {
  color: #2e4740;
  font-size: .61rem;
  font-weight: 900;
}

.dashboard-theme .tax-report-preview-list-copy small {
  color: #7b8883;
  font-size: .52rem;
  font-weight: 700;
}

.dashboard-theme .tax-report-preview-list-row > b {
  color: #17302a;
  font-size: .62rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.dashboard-theme .tax-report-preview-list-empty {
  color: #6f7d78;
  font-size: .58rem;
  font-weight: 750;
}

.dashboard-theme .tax-report-card.is-widget-maximized .tax-report-workspace,
.dashboard-theme .tax-vat-report-card.is-widget-maximized .tax-report-workspace {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.dashboard-theme .tax-report-card.is-widget-maximized .tax-table-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-theme .tax-report-card.is-widget-maximized .tax-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.dashboard-theme .tax-payment-order-link {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 980px) {
  .dashboard-theme .tax-filter-toolbar {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .tax-report-search-field {
    min-width: 0;
  }

  .dashboard-theme .tax-report-card.is-widget-maximized .tax-report-workspace {
    overflow: auto;
  }

  .dashboard-theme .tax-report-card.is-widget-maximized .tax-table-wrap {
    flex: 0 0 auto;
    max-height: calc(100dvh - 330px);
  }
}

@media (max-width: 760px) {
  .dashboard-theme .tax-report-preview-list-row {
    grid-template-columns: 68px minmax(0, 1fr) auto;
  }

  .dashboard-theme .tax-filter-form,
  .dashboard-theme .tax-filter-form-iibb {
    grid-template-columns: 1fr;
  }
}

/* ========================================================================== */
/* Impuestos — ajuste de modal IVA y resúmenes compactos de retenciones       */
/* ========================================================================== */
/* Los cards de retenciones heredan la altura compacta de Contabilidad (270px).
   El resumen debe distribuirse dentro de ese alto, no imponer un min-height
   superior que termine recortado por overflow:hidden. */
.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) {
  display: flex;
  flex-direction: column;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) > .tax-report-preview {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  grid-template-columns: 30px minmax(0, 1fr) minmax(190px, .9fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 5px 9px;
  padding: 8px 10px 7px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-icon {
  width: 30px;
  height: 30px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-copy {
  gap: 1px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-copy strong {
  font-size: .78rem;
  line-height: 1.12;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-copy p {
  font-size: .54rem;
  line-height: 1.18;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics {
  gap: 3px 10px;
  align-self: center;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics > span {
  gap: 0;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics small {
  font-size: .49rem;
  line-height: 1.1;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics :is(strong, b) {
  font-size: .66rem;
  line-height: 1.12;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics strong {
  font-size: .82rem;
}

/* El texto de estado repite la cantidad de comprobantes ya visible en métricas. */
.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics em {
  display: none;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list {
  gap: 2px;
  padding: 4px 7px;
  border-radius: 8px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-heading {
  font-size: .48rem;
  line-height: 1.1;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-heading small {
  font-size: .47rem;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-rows {
  gap: 1px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-row {
  grid-template-columns: 66px minmax(0, 1fr) minmax(86px, auto);
  gap: 6px;
  padding-top: 2px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-row > time {
  font-size: .50rem;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-copy strong {
  font-size: .53rem;
  line-height: 1.1;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-copy small {
  font-size: .46rem;
  line-height: 1.1;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-row > b {
  font-size: .54rem;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-hint {
  gap: 4px;
  padding-top: 3px;
  font-size: .53rem;
  line-height: 1.1;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-hint .ui-icon {
  width: 11px;
  height: 11px;
}

/* Posición IVA no necesita el modal casi fullscreen que usa el maestro/detalle
   de Contabilidad General. Se mantiene centrado, suficientemente ancho para las
   tres columnas y con alto determinado por su contenido. */
.dashboard-theme .widget-modal-backdrop:has(> .tax-vat-report-card.accounting-imputation-card.is-widget-maximized) {
  padding: clamp(22px, 4vw, 56px) !important;
}

.dashboard-theme .widget-modal-backdrop > .tax-vat-report-card.accounting-imputation-card.is-widget-maximized {
  --widget-modal-width: 1160px;
  width: min(1160px, calc(100vw - 64px)) !important;
  max-width: min(1160px, calc(100vw - 64px)) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 64px) !important;
  align-self: center !important;
  padding: 16px 18px 18px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  border-radius: 22px !important;
}

.dashboard-theme .tax-vat-report-card.is-widget-maximized .tax-report-workspace {
  flex: 0 1 auto;
  grid-template-rows: auto auto;
  overflow: visible;
}

.dashboard-theme .tax-vat-report-card.is-widget-maximized .tax-vat-results {
  align-items: stretch;
}

@media (max-width: 1180px) {
  .dashboard-theme .widget-modal-backdrop > .tax-vat-report-card.accounting-imputation-card.is-widget-maximized {
    width: calc(100vw - 36px) !important;
    max-width: calc(100vw - 36px) !important;
    max-height: calc(100dvh - 36px) !important;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) > .tax-report-preview {
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
  }

  .dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics,
  .dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list,
  .dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-hint {
    grid-column: 1 / -1;
  }
}


/* ========================================================================== */
/* Impuestos — selector unificado de retenciones y fechas rápidas de IVA      */
/* ========================================================================== */
.dashboard-theme .tax-vat-preview-period-editor {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid #d8e5df;
  border-radius: 9px;
  background: rgba(255, 255, 255, .8);
}

.dashboard-theme .tax-vat-preview-period-editor label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dashboard-theme .tax-vat-preview-period-editor label > span {
  color: #60736d;
  font-size: .47rem;
  font-weight: 900;
  letter-spacing: .045em;
  line-height: 1;
  text-transform: uppercase;
}

.dashboard-theme .tax-vat-preview-period-editor input {
  width: 118px;
  min-width: 0;
  min-height: 27px;
  padding: 3px 5px;
  border: 1px solid #cad9d3;
  border-radius: 7px;
  background: #fff;
  color: #203b34;
  font: inherit;
  font-size: .58rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .tax-vat-preview-period-editor input:focus {
  border-color: #58a58d;
  outline: 2px solid rgba(38, 139, 107, .1);
}

.dashboard-theme .tax-vat-preview-period-editor input[aria-invalid="true"] {
  border-color: #c86d5d;
}

.dashboard-theme .tax-vat-preview-period-separator {
  padding-bottom: 7px;
  color: #7a8b85;
  font-size: .62rem;
  font-weight: 900;
}

.dashboard-theme .tax-withholding-report-heading {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.dashboard-theme .tax-filter-form-withholdings {
  grid-template-columns: minmax(160px, 220px) minmax(180px, 260px) repeat(2, minmax(150px, 220px));
}

.dashboard-theme .tax-withholding-report-card[data-tax-withholding-kind="income"] .tax-filter-form-withholdings {
  grid-template-columns: minmax(160px, 220px) repeat(2, minmax(150px, 220px));
}

.dashboard-theme .tax-withholding-report-card [data-tax-iibb-only][hidden],
.dashboard-theme .tax-withholding-report-card [data-tax-iibb-column][hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .dashboard-theme .tax-filter-form-withholdings,
  .dashboard-theme .tax-withholding-report-card[data-tax-withholding-kind="income"] .tax-filter-form-withholdings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-theme .tax-vat-preview-heading {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .dashboard-theme .tax-vat-preview-period-editor {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    width: 100%;
  }

  .dashboard-theme .tax-vat-preview-period-editor input {
    width: 100%;
  }

  .dashboard-theme .tax-filter-form-withholdings,
  .dashboard-theme .tax-withholding-report-card[data-tax-withholding-kind="income"] .tax-filter-form-withholdings {
    grid-template-columns: 1fr;
  }
}

/* Evita que los dos calendarios compactos de IVA se compriman entre sí. */
.dashboard-theme .tax-vat-preview-period-editor {
  flex: 0 0 auto;
}

.dashboard-theme .tax-vat-preview-period-editor label {
  flex: 0 0 112px;
}

.dashboard-theme .tax-vat-preview-period-editor input {
  width: 112px;
}

@media (max-width: 760px) {
  .dashboard-theme .tax-vat-preview-period-editor {
    flex: initial;
  }

  .dashboard-theme .tax-vat-preview-period-editor label {
    min-width: 0;
  }

  .dashboard-theme .tax-vat-preview-period-editor input {
    width: 100%;
  }
}

.dashboard-theme .tax-vat-preview-period-editor {
  width: max-content;
  max-width: 100%;
}

@media (max-width: 760px) {
  .dashboard-theme .tax-vat-preview-period-editor {
    width: 100%;
  }
}


/* ========================================================================== */
/* Impuestos — ajuste de layout compacto IVA y filtro unificado abierto       */
/* ========================================================================== */
.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-heading {
  grid-template-columns: 30px minmax(105px, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 0;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-period-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 5px;
  width: auto;
  max-width: none;
  padding: 3px 5px;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-period-editor label {
  min-width: 0;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-period-editor input {
  width: 106px;
  min-height: 25px;
  padding: 2px 4px;
  font-size: .54rem;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-period-separator {
  display: none;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-ledger {
  margin-top: 0;
}

@media (max-width: 1180px) {
  .dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-heading {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-period-editor {
    grid-column: 1 / -1;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-period-editor input {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-period-editor {
    grid-template-columns: 1fr;
  }
}

/* Resaltado compartido para coincidencias en buscadores del dashboard. */
mark.search-match-highlight[data-search-match-highlight] {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 0.08em;
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--accent-dark) 58%, transparent);
  font: inherit;
}

/* ========================================================================== */
/* Dashboard navigation groups — single-open accordion                        */
/* ========================================================================== */
.dashboard-theme .dashboard-nav-group {
  gap: 0 !important;
  min-width: 0;
}

.dashboard-theme .dashboard-nav-group + .dashboard-nav-group,
.dashboard-theme.sidebar-expanded .dashboard-nav-group + .dashboard-nav-group,
.dashboard-theme.sidebar-collapsed .dashboard-nav-group + .dashboard-nav-group {
  margin-top: 4px;
  padding-top: 0;
  border-top: 0;
}

.dashboard-theme .dashboard-nav-group-toggle {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  color: rgba(250, 247, 239, .66);
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.dashboard-theme .dashboard-nav-group-toggle:hover,
.dashboard-theme .dashboard-nav-group-toggle:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.dashboard-theme .dashboard-nav-group-toggle:focus-visible {
  outline: 2px solid rgba(250, 247, 239, .72);
  outline-offset: 1px;
}

.dashboard-theme .dashboard-nav-group.has-active .dashboard-nav-group-toggle {
  color: rgba(250, 247, 239, .94);
}

.dashboard-theme .dashboard-nav-group.is-open .dashboard-nav-group-toggle {
  background: rgba(255, 255, 255, .055);
}

.dashboard-theme .dashboard-nav-group-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.dashboard-theme .dashboard-nav-group-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  font-size: .52rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: left;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: .075em;
  white-space: nowrap;
}

.dashboard-theme .dashboard-nav-group-chevron {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  margin-right: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: .78;
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}

.dashboard-theme .dashboard-nav-group.is-open .dashboard-nav-group-chevron {
  transform: rotate(45deg);
}

.dashboard-theme .dashboard-nav-group-items {
  display: flex;
  min-width: 0;
  padding: 2px 0 3px;
  flex-direction: column;
  gap: 2px;
}

.dashboard-theme .dashboard-nav-group:not(.is-open) .dashboard-nav-group-items,
.dashboard-theme .dashboard-nav-group-items[hidden] {
  display: none !important;
}

@media (min-width: 1180px) {
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-toggle {
    min-height: 32px;
    padding: 6px 8px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items {
    padding: 2px 0 3px 8px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button {
    min-height: 36px;
    padding: 6px 8px;
    gap: 9px;
    border-radius: 10px;
    font-size: .62rem;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button .ui-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }
}

@media (min-width: 768px) {
  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-toggle,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-toggle {
    min-height: 36px;
    padding: 6px 4px;
    justify-content: center;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-label,
  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-chevron,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-label,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-chevron {
    display: none;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-icon,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-icon {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-items,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items {
    padding: 2px 0;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button {
    min-height: 38px;
    padding-top: 5px;
    padding-bottom: 5px;
  }
}

@media (max-width: 767px) {
  .dashboard-theme .dashboard-nav-group + .dashboard-nav-group,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group + .dashboard-nav-group,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group + .dashboard-nav-group {
    margin-top: 5px;
  }

  .dashboard-theme .dashboard-nav-group-toggle,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-toggle,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-toggle {
    min-height: 38px;
    padding: 7px 9px;
    border-radius: 11px;
  }

  .dashboard-theme .dashboard-nav-group-label,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-label,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-label {
    display: block;
    font-size: .54rem;
  }

  .dashboard-theme .dashboard-nav-group-chevron,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-chevron,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-chevron {
    display: block;
  }

  .dashboard-theme .dashboard-nav-group-items,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items {
    padding: 2px 0 4px 8px;
  }

  .dashboard-theme .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button {
    min-height: 40px;
    padding: 7px 9px;
  }
}

/* ========================================================================== */
/* Impuestos — Subdiarios de Ventas                                           */
/* ========================================================================== */
.dashboard-theme .tax-sales-filter-grid {
  grid-template-columns: minmax(210px, 1.2fr) repeat(2, minmax(150px, .8fr));
  align-items: end;
  gap: 8px 10px;
  margin-top: 0;
}

.dashboard-theme .tax-sales-filter-grid > .tax-sales-mode-fields {
  grid-column: 1 / -1;
}

.dashboard-theme .tax-sales-mode-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 220px)) minmax(0, 1fr);
  align-items: end;
  gap: 8px 10px;
}

.dashboard-theme .tax-sales-mode-fields[hidden] {
  display: none !important;
}

.dashboard-theme .tax-sales-point-field {
  align-self: end;
}

.dashboard-theme .tax-sales-point-field .accounting-imputation-account-control {
  min-height: 31px;
}

.dashboard-theme .tax-sales-point-field .accounting-imputation-account-popover {
  width: min(390px, calc(100vw - 56px));
}

/* El selector se superpone al contenido del reporte: no debe incrementar la
   altura del filtro ni quedar recortado por el overflow del panel. */
.dashboard-theme .tax-sales-filter-body,
.dashboard-theme .tax-sales-filter-grid,
.dashboard-theme .tax-sales-mode-fields {
  overflow: visible;
}

.dashboard-theme .tax-sales-point-field .accounting-imputation-account-popover {
  z-index: 180;
}

.dashboard-theme [data-tax-sales-pos-field="to"] .accounting-imputation-account-popover {
  right: 0;
  left: auto;
}

.dashboard-theme .tax-sales-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  align-self: stretch;
  gap: 6px 12px;
  padding: 7px 10px;
  border: 1px solid #d6e1dd;
  border-radius: 9px;
  background: rgba(255, 255, 255, .55);
}

.dashboard-theme .tax-sales-checks label,
.dashboard-theme .tax-sales-radio-group label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #314d45;
  font-size: .66rem;
  font-weight: 750;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: normal;
}

.dashboard-theme .tax-sales-checks input,
.dashboard-theme .tax-sales-radio-group input {
  flex: 0 0 auto;
  width: 15px;
  min-height: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  accent-color: #247c65;
}

.dashboard-theme .tax-sales-checks label > span,
.dashboard-theme .tax-sales-radio-group label > span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-transform: inherit;
}

.dashboard-theme .tax-sales-province-fields {
  grid-template-columns: minmax(260px, .95fr) minmax(210px, .75fr) minmax(0, 1fr);
}

.dashboard-theme .tax-sales-radio-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 16px;
  min-width: 0;
  margin: 0;
  padding: 6px 10px 7px;
  border: 1px solid #d6e1dd;
  border-radius: 9px;
  background: rgba(255, 255, 255, .55);
}

.dashboard-theme .tax-sales-radio-group legend {
  width: 100%;
  padding: 0;
  color: #5b716a;
  font-size: .59rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.dashboard-theme .tax-sales-results {
  min-height: 0;
}

.dashboard-theme .tax-sales-table-wrap table {
  min-width: 900px;
}

/* El Subdiario estándar tiene muchas columnas cortas. En el modal se fuerza
   una grilla compacta para que entren todas en el ancho disponible sin scroll
   horizontal. Si se separan percepciones por jurisdicción, el número de
   columnas pasa a ser dinámico y se conserva el desplazamiento horizontal. */
.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: .57rem;
}

.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table th,
.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table td {
  min-width: 0 !important;
  padding: 5px 4px;
  line-height: 1.15;
}

.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table th {
  font-size: .53rem;
}

.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table th button {
  gap: 3px;
  min-height: 24px;
  line-height: 1.05;
  white-space: normal;
}

.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table td {
  font-size: .57rem;
  white-space: nowrap;
}

.dashboard-theme .tax-sales-journal-table th:nth-child(1),
.dashboard-theme .tax-sales-journal-table td:nth-child(1) { width: 5.2%; }
.dashboard-theme .tax-sales-journal-table th:nth-child(2),
.dashboard-theme .tax-sales-journal-table td:nth-child(2) { width: 6.2%; }
.dashboard-theme .tax-sales-journal-table th:nth-child(3),
.dashboard-theme .tax-sales-journal-table td:nth-child(3) { width: 12.2%; }
.dashboard-theme .tax-sales-journal-table th:nth-child(4),
.dashboard-theme .tax-sales-journal-table td:nth-child(4) { width: 16.4%; }
.dashboard-theme .tax-sales-journal-table th:nth-child(5),
.dashboard-theme .tax-sales-journal-table td:nth-child(5) { width: 9.2%; }
.dashboard-theme .tax-sales-journal-table th:nth-child(n+6),
.dashboard-theme .tax-sales-journal-table td:nth-child(n+6) { width: 5.08%; }

.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table.has-split-iibb-columns {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table.has-split-iibb-columns th,
.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table.has-split-iibb-columns td {
  width: auto;
  min-width: 78px !important;
}

.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table.has-split-iibb-columns th:nth-child(3),
.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table.has-split-iibb-columns td:nth-child(3),
.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table.has-split-iibb-columns th:nth-child(4),
.dashboard-theme .tax-sales-table-wrap .tax-sales-journal-table.has-split-iibb-columns td:nth-child(4) {
  min-width: 150px !important;
}

.dashboard-theme .tax-sales-voucher-layout {
  display: grid;
  grid-template-columns: minmax(330px, .78fr) minmax(420px, 1.22fr);
  gap: 14px;
  min-width: 780px;
}

.dashboard-theme .tax-sales-voucher-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d5e1dc;
  border-radius: 10px;
  background: #fff;
}

.dashboard-theme .tax-sales-voucher-panel h3 {
  margin: 0;
  padding: 9px 11px;
  border-bottom: 1px solid #dfe8e4;
  background: #f7faf8;
  color: #314d45;
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dashboard-theme .tax-sales-voucher-panel .ranking-table {
  min-width: 100%;
  border: 0;
  border-radius: 0;
}

.dashboard-theme .tax-sales-month-row {
  cursor: pointer;
}

.dashboard-theme .tax-sales-month-row.is-selected > td {
  background: rgba(38, 139, 107, .11);
  color: #173f34;
  font-weight: 850;
}

.dashboard-theme .tax-sales-total-row > td {
  background: #f5f8f6;
  font-weight: 900;
}

.dashboard-theme .tax-sales-preview-list-row {
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr) minmax(92px, auto) !important;
}

.dashboard-theme .tax-sales-report-card:not(.is-widget-maximized) .tax-sales-preview-list-row > time {
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .dashboard-theme .tax-sales-mode-fields,
  .dashboard-theme .tax-sales-province-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .tax-sales-checks {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .dashboard-theme .tax-sales-filter-grid,
  .dashboard-theme .tax-sales-mode-fields,
  .dashboard-theme .tax-sales-province-fields {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .tax-sales-checks {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .tax-sales-voucher-layout {
    grid-template-columns: 1fr;
    min-width: 620px;
  }
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-print-button {
  display: none !important;
}

/* ========================================================================== */
/* Impuestos — Subdiarios: capas de buscadores y selección homogénea          */
/* ========================================================================== */
/* La regla específica de Impuestos que mantiene el filtro recortado tiene
   mayor especificidad que el comportamiento base de Contabilidad General.
   Cuando hay un buscador de punto de venta abierto, elevar el panel completo
   y permitir overflow evita que el listado quede oculto detrás de la tabla. */
.dashboard-theme .tax-query-section.accounting-imputation-filter-panel.has-account-popover {
  position: relative;
  z-index: 320;
  overflow: visible;
}

.dashboard-theme .tax-query-section.accounting-imputation-filter-panel.has-account-popover .tax-filter-body,
.dashboard-theme .tax-query-section.accounting-imputation-filter-panel.has-account-popover .tax-sales-filter-grid,
.dashboard-theme .tax-query-section.accounting-imputation-filter-panel.has-account-popover .tax-sales-mode-fields,
.dashboard-theme .tax-query-section.accounting-imputation-filter-panel.has-account-popover .tax-sales-point-field {
  overflow: visible;
}

.dashboard-theme .tax-query-section.accounting-imputation-filter-panel.has-account-popover .tax-sales-point-field {
  z-index: 321;
}

.dashboard-theme .tax-query-section.accounting-imputation-filter-panel.has-account-popover .accounting-imputation-account-popover {
  z-index: 322;
}

/* Mantener la tabla por debajo del filtro mientras el selector está abierto. */
.dashboard-theme .tax-sales-results {
  position: relative;
  z-index: 1;
}

/* El mes seleccionado usa exactamente la misma convención visual que las
   filas seleccionadas de Contabilidad General: fondo neutro + acento naranja
   de 3 px en el borde izquierdo. */
.dashboard-theme .tax-sales-month-row.is-selected > td {
  background: var(--data-table-selected);
  color: var(--data-table-text);
  font-weight: 850;
}

.dashboard-theme .tax-sales-month-row.is-selected > td:first-child {
  box-shadow: inset 3px 0 0 var(--data-table-selected-accent);
}

/* ========================================================================== */
/* Impuestos — Etapa 1 de jerarquía visual en cards minimizados               */
/* ========================================================================== */
/* Cada resumen conserva la misma estructura y altura funcional, pero suma
   identidad por reporte, una cabecera interna más clara y una métrica líder. */
.dashboard-theme .tax-vat-report-card {
  --tax-preview-accent: #247c65;
  --tax-preview-accent-soft: rgba(36, 124, 101, .10);
  --tax-preview-accent-border: rgba(36, 124, 101, .28);
}

.dashboard-theme .tax-withholding-report-card {
  --tax-preview-accent: #2f7183;
  --tax-preview-accent-soft: rgba(47, 113, 131, .10);
  --tax-preview-accent-border: rgba(47, 113, 131, .26);
}

.dashboard-theme .tax-sales-report-card {
  --tax-preview-accent: #c97718;
  --tax-preview-accent-soft: rgba(201, 119, 24, .11);
  --tax-preview-accent-border: rgba(201, 119, 24, .30);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) > .tax-report-preview {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--tax-preview-accent) 18%, #dbe5e1);
  background:
    linear-gradient(105deg, var(--tax-preview-accent-soft) 0, rgba(255,255,255,0) 18%),
    linear-gradient(145deg, #fff 0%, #f8fbf9 100%);
  box-shadow:
    inset 3px 0 0 var(--tax-preview-accent),
    0 8px 18px rgba(22, 48, 41, .035);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) > .tax-report-preview::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 86px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--tax-preview-accent));
  opacity: .65;
  pointer-events: none;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-preview-icon {
  color: var(--tax-preview-accent);
  filter: drop-shadow(0 2px 3px var(--tax-preview-accent-soft));
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-preview-copy {
  position: relative;
  padding-left: 8px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-preview-copy::before {
  content: "";
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 0;
  width: 2px;
  border-radius: 999px;
  background: var(--tax-preview-accent-border);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-preview-copy strong {
  color: #17302a;
  font-weight: 950;
  letter-spacing: -.012em;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-preview-copy p {
  color: #62766f;
  font-weight: 700;
}

/* En Retenciones y Subdiarios la primera métrica funciona como KPI principal
   sin alterar la grilla compacta que evita recortes en cards de 270px. */
.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics > span:first-child {
  position: relative;
  margin: -2px 0;
  padding: 4px 6px 4px 8px;
  border: 1px solid var(--tax-preview-accent-border);
  border-radius: 8px;
  background: var(--tax-preview-accent-soft);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics > span:first-child::before {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 3px;
  width: 2px;
  border-radius: 999px;
  background: var(--tax-preview-accent);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics > span:first-child small {
  color: color-mix(in srgb, var(--tax-preview-accent) 84%, #17302a);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics > span:first-child strong {
  color: #102e27;
  font-size: .88rem;
  letter-spacing: -.018em;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list {
  border-color: color-mix(in srgb, var(--tax-preview-accent) 12%, #dce7e2);
  background: rgba(255, 255, 255, .78);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-heading {
  color: color-mix(in srgb, var(--tax-preview-accent) 72%, #314d45);
}

/* Posición IVA: Débito / Crédito mantienen equivalencia y la posición neta
   queda visualmente como conclusión del período. */
.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-heading {
  position: relative;
  padding: 1px 2px 3px;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-section {
  position: relative;
  overflow: hidden;
  border-color: #d9e5e0;
  background: rgba(255, 255, 255, .88);
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-section::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: rgba(36, 124, 101, .30);
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-section:first-child::before {
  background: rgba(201, 119, 24, .60);
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-section:nth-child(2)::before {
  background: rgba(47, 113, 131, .52);
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-position {
  border-color: rgba(36, 124, 101, .34);
  background: linear-gradient(145deg, #fff 0%, #eaf6f0 100%);
  box-shadow: inset 0 0 0 1px rgba(36, 124, 101, .04);
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-position::before {
  height: 3px;
  background: var(--tax-preview-accent);
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-position > strong {
  color: #1d654f;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-position .is-total dd {
  color: #102e27;
  font-size: .79rem;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-period-editor {
  border-color: var(--tax-preview-accent-border);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 7px rgba(22, 48, 41, .035);
}

/* El Subdiario pertenece conceptualmente a Ventas: el color y el icono
   acompañan el mismo lenguaje del módulo sin dejar de vivir dentro de Impuestos. */
.dashboard-theme .tax-sales-report-card:not(.is-widget-maximized) .tax-report-preview-icon {
  color: var(--tax-preview-accent);
}

@media (max-width: 760px) {
  .dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-preview-copy {
    padding-left: 7px;
  }

  .dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics > span:first-child {
    margin: 0;
  }
}

/* ========================================================================== */
/* Impuestos — Etapa 2 de refinamiento visual en cards minimizados            */
/* ========================================================================== */
/* Esta capa no altera alturas ni estructura funcional. Refuerza superficie,
   microtipografía, separación de métricas y lectura de los mini listados. */
.dashboard-theme .tax-report-card:not(.is-widget-maximized) {
  border-color: color-mix(in srgb, var(--tax-preview-accent) 12%, #d7e3de);
  background:
    linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(251,252,250,.98) 100%);
  box-shadow:
    0 14px 30px rgba(20, 45, 38, .065),
    0 2px 7px rgba(20, 45, 38, .028),
    inset 0 1px 0 rgba(255,255,255,.96);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-heading {
  position: relative;
  margin-bottom: 6px;
  padding: 0 2px 3px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-heading::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 0;
  left: 2px;
  height: 1px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--tax-preview-accent) 20%, transparent),
    rgba(216, 228, 223, .74) 34%,
    rgba(216, 228, 223, .22) 78%,
    transparent);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-heading h2 {
  color: #142f28;
  font-weight: 950;
  letter-spacing: -.018em;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-heading p {
  color: #71817c;
  font-weight: 650;
  letter-spacing: -.004em;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) > .tax-report-preview {
  border-color: color-mix(in srgb, var(--tax-preview-accent) 20%, #d8e4df);
  box-shadow:
    inset 3px 0 0 var(--tax-preview-accent),
    inset 0 1px 0 rgba(255,255,255,.92),
    0 7px 16px rgba(22, 48, 41, .042);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-preview-copy strong {
  color: #132f28;
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized) .tax-report-preview-copy p {
  color: #697b75;
}

/* Métricas secundarias: se separan con una guía tenue para que el ojo pueda
   recorrer el bloque en columnas sin convertir cada valor en un chip. */
.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics > span:not(:first-child) {
  position: relative;
  padding-left: 7px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics > span:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, #dce7e2 22%, #dce7e2 78%, transparent);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics small {
  color: #71837d;
  font-weight: 900;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics b {
  color: #23443b;
}

/* Mini listados: una única superficie, cabecera más limpia y filas con
   pequeñas anclas visuales en fecha e importe. */
.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list {
  position: relative;
  border-color: color-mix(in srgb, var(--tax-preview-accent) 14%, #dce7e2);
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(249,251,250,.90));
  box-shadow:
    inset 2px 0 0 color-mix(in srgb, var(--tax-preview-accent) 58%, transparent),
    inset 0 1px 0 rgba(255,255,255,.9);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-heading {
  padding-bottom: 3px;
  border-bottom: 1px solid #e8efec;
  color: #506a62;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-heading > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-heading > span::before {
  content: "";
  width: 4px;
  height: 4px;
  flex: 0 0 4px;
  border-radius: 999px;
  background: var(--tax-preview-accent);
  box-shadow: 0 0 0 2px var(--tax-preview-accent-soft);
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-heading small {
  color: #83908c;
  font-weight: 800;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-row {
  min-height: 20px;
  border-top-color: #edf2f0;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-row > time {
  justify-self: start;
  padding: 2px 4px;
  border: 1px solid #e3ebe7;
  border-radius: 5px;
  color: #5c7069;
  background: #f6f9f7;
  font-weight: 900;
  line-height: 1;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-copy strong {
  color: #29483f;
  font-weight: 950;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-copy small {
  color: #84918c;
}

.dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-row > b {
  color: #18372f;
  font-weight: 950;
}

/* IVA: los tres paneles se leen como un conjunto y el total de cada lado
   queda anclado con una superficie tenue. */
.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-ledger {
  gap: 8px;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-section {
  box-shadow:
    0 4px 10px rgba(22, 48, 41, .026),
    inset 0 1px 0 rgba(255,255,255,.92);
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-section > strong {
  color: #526e65;
  letter-spacing: .065em;
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-section .is-total {
  margin: 3px -3px -1px;
  padding: 4px 3px 2px;
  border-top: 1px solid #dfe9e5;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(242,247,245,.9), rgba(255,255,255,.3));
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-position {
  box-shadow:
    0 5px 13px rgba(36, 124, 101, .055),
    inset 0 0 0 1px rgba(36, 124, 101, .045),
    inset 0 1px 0 rgba(255,255,255,.95);
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-position .is-total {
  border-top-color: rgba(36, 124, 101, .18);
  background: linear-gradient(90deg, rgba(36,124,101,.075), rgba(255,255,255,.22));
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-compact-position em {
  display: inline-flex;
  margin-top: 4px;
  padding: 2px 5px;
  border: 1px solid rgba(36, 124, 101, .18);
  border-radius: 999px;
  background: rgba(36, 124, 101, .065);
}

.dashboard-theme .tax-vat-report-card:not(.is-widget-maximized) .tax-vat-preview-period-editor {
  border-radius: 9px;
  box-shadow:
    0 3px 8px rgba(22,48,41,.035),
    inset 0 1px 0 rgba(255,255,255,.9);
}

/* Los controles de cabecera conservan su forma global pero ganan un pequeño
   feedback cromático sólo dentro de los cards de Impuestos. */
@media (hover: hover) and (pointer: fine) {
  .dashboard-theme .tax-report-card:not(.is-widget-maximized) .widget-control-group button:hover {
    border-color: color-mix(in srgb, var(--tax-preview-accent) 34%, #cad8d2);
    color: color-mix(in srgb, var(--tax-preview-accent) 78%, #17302a);
    background: color-mix(in srgb, var(--tax-preview-accent-soft) 62%, #fff);
  }
}

@media (max-width: 760px) {
  .dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-metrics > span:not(:first-child) {
    padding-left: 6px;
  }

  .dashboard-theme .tax-report-card:not(.is-widget-maximized):not(.tax-vat-report-card) .tax-report-preview-list-row > time {
    padding-inline: 3px;
  }
}

/* ========================================================================== */
/* Impuestos — Subdiarios: filtro maximizado compacto                         */
/* ========================================================================== */
/* En escritorio, el Subdiario usa una sola fila para los cinco parámetros
   principales (reporte, período y rango de puntos de venta). El contenedor
   del modo journal se aplana sólo visualmente para que sus dos buscadores
   participen de la misma grilla sin cambiar la estructura ni la lógica JS. */
@media (min-width: 1180px) {
  .dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-filter-grid {
    grid-template-columns:
      minmax(250px, 1.45fr)
      minmax(132px, .72fr)
      minmax(132px, .72fr)
      minmax(185px, .96fr)
      minmax(185px, .96fr);
    gap: 5px 8px;
    align-items: end;
  }

  .dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-filter-grid > .tax-sales-mode-fields[data-tax-sales-mode="journal"]:not([hidden]) {
    display: contents;
  }

  .dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-checks {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px 10px;
    padding: 5px 8px;
  }

  .dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-province-fields {
    grid-column: 1 / -1;
  }
}

/* Menor altura del bloque sin reducir el área útil de los buscadores ni
   afectar los filtros de los demás reportes de Impuestos. */
.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-filter-body {
  padding: 0 8px 5px;
}

.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-filter-grid {
  padding-top: 5px;
}

.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-filter-grid > label,
.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-point-field {
  gap: 2px;
}

.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-filter-grid label > span,
.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-point-field .accounting-imputation-account-label {
  font-size: .56rem;
  line-height: 1.05;
}

.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-filter-grid > label > :is(input, select),
.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-point-field .accounting-imputation-account-control {
  min-height: 29px;
  height: 29px;
}

.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-filter-grid > label > :is(input, select) {
  padding-block: 4px;
}

.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-checks label {
  min-height: 18px;
  font-size: .62rem;
  line-height: 1.1;
}

.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-checks input {
  width: 14px;
  min-height: 14px;
  height: 14px;
}

.dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-query-state {
  min-height: 15px;
  margin-top: 3px;
  font-size: .61rem;
  line-height: 1.1;
}

@media (max-width: 1179px) {
  .dashboard-theme .tax-sales-report-card.is-widget-maximized .tax-sales-checks {
    padding-block: 5px;
  }
}

/* ========================================================================== */
/* Impuestos — Subdiarios de Compras (card independiente)                     */
/* ========================================================================== */
.dashboard-theme .tax-purchase-report-card {
  --tax-preview-accent: #7a6541;
  --tax-preview-accent-soft: rgba(122, 101, 65, .10);
  --tax-preview-accent-border: rgba(122, 101, 65, .28);
}

.dashboard-theme .tax-purchase-report-card:not(.is-widget-maximized) .tax-report-preview-icon {
  color: var(--tax-preview-accent);
}

.dashboard-theme .tax-purchase-filter-grid {
  grid-template-columns: minmax(210px, 1.2fr) repeat(2, minmax(150px, .8fr));
  align-items: end;
  gap: 8px 10px;
  margin-top: 0;
  overflow: visible;
}

.dashboard-theme .tax-purchase-filter-grid > .tax-purchase-mode-fields {
  grid-column: 1 / -1;
}

.dashboard-theme .tax-purchase-mode-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: 8px 10px;
  overflow: visible;
}

.dashboard-theme .tax-purchase-mode-fields[hidden] {
  display: none !important;
}

.dashboard-theme .tax-purchase-checks {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  align-self: stretch;
  gap: 6px 12px;
  padding: 7px 10px;
  border: 1px solid #d6e1dd;
  border-radius: 9px;
  background: rgba(255, 255, 255, .55);
}

.dashboard-theme .tax-purchase-checks label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #314d45;
  font-size: .66rem;
  font-weight: 750;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: normal;
}

.dashboard-theme .tax-purchase-checks input {
  flex: 0 0 auto;
  width: 15px;
  min-height: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  accent-color: #247c65;
}

.dashboard-theme .tax-purchase-checks label > span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-transform: inherit;
}

.dashboard-theme .tax-purchase-province-fields {
  grid-template-columns: minmax(260px, .95fr) minmax(210px, .75fr) minmax(0, 1fr);
}

.dashboard-theme .tax-purchase-results {
  position: relative;
  z-index: 1;
  min-height: 0;
}

.dashboard-theme .tax-purchase-table-wrap table {
  min-width: 900px;
}

.dashboard-theme .tax-purchase-journal-table {
  min-width: 1320px !important;
  table-layout: auto;
}

.dashboard-theme .tax-purchase-journal-table.has-imputations {
  min-width: 1700px !important;
}

.dashboard-theme .tax-purchase-month-row {
  cursor: pointer;
}

.dashboard-theme .tax-purchase-month-row.is-selected > td {
  background: var(--data-table-selected);
  color: var(--data-table-text);
  font-weight: 850;
}

.dashboard-theme .tax-purchase-month-row.is-selected > td:first-child {
  box-shadow: inset 3px 0 0 var(--data-table-selected-accent);
}

.dashboard-theme .tax-purchase-report-card:not(.is-widget-maximized) .tax-purchase-preview-list .tax-report-preview-list-row > time {
  white-space: nowrap;
}

@media (min-width: 1180px) {
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-filter-grid {
    grid-template-columns: minmax(260px, 1.35fr) minmax(150px, .8fr) minmax(150px, .8fr);
    gap: 5px 8px;
    align-items: end;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-filter-grid > .tax-purchase-mode-fields[data-tax-purchase-mode="journal"]:not([hidden]) {
    display: contents;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-checks {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px 10px;
    padding: 5px 8px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-province-fields {
    grid-column: 1 / -1;
  }
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-filter-body {
  padding: 0 8px 5px;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-filter-grid {
  padding-top: 5px;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-filter-grid > label {
  gap: 2px;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-filter-grid label > span {
  font-size: .56rem;
  line-height: 1.05;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-filter-grid > label > :is(input, select) {
  min-height: 29px;
  height: 29px;
  padding-block: 4px;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-checks label {
  min-height: 18px;
  font-size: .62rem;
  line-height: 1.1;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-purchase-checks input {
  width: 14px;
  min-height: 14px;
  height: 14px;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized .tax-query-state {
  min-height: 15px;
  margin-top: 3px;
  font-size: .61rem;
  line-height: 1.1;
}

@media (max-width: 1080px) {
  .dashboard-theme .tax-purchase-checks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-theme .tax-purchase-province-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-theme .tax-purchase-filter-grid,
  .dashboard-theme .tax-purchase-mode-fields,
  .dashboard-theme .tax-purchase-province-fields,
  .dashboard-theme .tax-purchase-checks {
    grid-template-columns: 1fr;
  }
}

/* Impuestos · Compras: Subdiario compacto y maestro-detalle por provincia. */
@media (min-width: 1180px) {
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-table-wrap .tax-purchase-journal-table:not(.has-imputations) {
    width: 100%;
    min-width: 0 !important;
    table-layout: fixed;
    font-size: .50rem;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) th,
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) td {
    min-width: 0 !important;
    padding: 4px 3px;
    line-height: 1.08;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) th {
    font-size: .47rem;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) th button {
    gap: 2px;
    min-height: 22px;
    padding: 0;
    line-height: 1.02;
    white-space: normal;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) td {
    overflow: hidden;
    font-size: .49rem;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(1),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(1) { width: 4.6%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(2),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(2) { width: 5.8%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(3),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(3) { width: 9.7%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(4),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(4) { width: 12%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(5),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(5) { width: 7.9%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(n+6),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(n+6) { width: 5%; }
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-table-wrap {
  overflow: hidden;
}

.dashboard-theme .tax-purchase-province-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(430px, .9fr);
  gap: 10px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.dashboard-theme .tax-purchase-province-master-pane,
.dashboard-theme .tax-purchase-province-detail-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dbe5e1;
  border-radius: 11px;
  background: #fff;
}

.dashboard-theme .tax-purchase-province-detail-pane {
  background: #f9fbfa;
}

.dashboard-theme .tax-purchase-province-master-heading,
.dashboard-theme .tax-purchase-province-detail-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 42px;
  padding: 7px 9px 6px;
  border-bottom: 1px solid #e2e8e5;
}

.dashboard-theme .tax-purchase-province-master-heading > div,
.dashboard-theme .tax-purchase-province-detail-heading > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.dashboard-theme .tax-purchase-province-master-heading .eyebrow,
.dashboard-theme .tax-purchase-province-detail-heading .eyebrow {
  color: #a86712;
  font-size: .52rem;
  font-weight: 950;
  letter-spacing: .06em;
}

.dashboard-theme .tax-purchase-province-master-heading h3,
.dashboard-theme .tax-purchase-province-detail-heading h3 {
  overflow: hidden;
  margin: 0;
  color: #263136;
  font-size: .74rem;
  font-weight: 950;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .tax-purchase-province-master-heading p,
.dashboard-theme .tax-purchase-province-detail-heading p {
  overflow: hidden;
  margin: 1px 0 0;
  color: #6e7d78;
  font-size: .56rem;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .tax-purchase-province-master-table-wrap,
.dashboard-theme .tax-purchase-province-detail-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.dashboard-theme .tax-purchase-province-master-table {
  min-width: 780px !important;
}

.dashboard-theme .tax-purchase-province-detail-table {
  min-width: 960px !important;
}

.dashboard-theme .tax-purchase-province-master-table th,
.dashboard-theme .tax-purchase-province-master-table td,
.dashboard-theme .tax-purchase-province-detail-table th,
.dashboard-theme .tax-purchase-province-detail-table td {
  padding: 5px 6px;
}

.dashboard-theme .tax-purchase-province-master-table th,
.dashboard-theme .tax-purchase-province-detail-table th {
  font-size: .51rem;
}

.dashboard-theme .tax-purchase-province-master-table td,
.dashboard-theme .tax-purchase-province-detail-table td {
  font-size: .57rem;
}

.dashboard-theme .tax-purchase-province-row {
  cursor: pointer;
}

.dashboard-theme .tax-purchase-province-row:hover > td {
  background: #f7f7f4;
}

.dashboard-theme .tax-purchase-province-row.is-selected > td {
  background: #f3f0e8;
}

.dashboard-theme .tax-purchase-province-row.is-selected > td:first-child {
  box-shadow: inset 3px 0 0 #f59f2f;
}

.dashboard-theme .tax-purchase-province-row:focus-visible {
  outline: 2px solid rgba(245, 159, 47, .55);
  outline-offset: -2px;
}

.dashboard-theme .tax-purchase-province-detail-empty {
  display: grid;
  flex: 1 1 auto;
  place-content: center;
  gap: 4px;
  min-height: 160px;
  padding: 20px;
  color: #73817c;
  text-align: center;
}

.dashboard-theme .tax-purchase-province-detail-empty strong {
  color: #35413e;
  font-size: .76rem;
}

.dashboard-theme .tax-purchase-province-detail-empty p {
  max-width: 340px;
  margin: 0;
  font-size: .61rem;
  line-height: 1.35;
}

@media (max-width: 1179px) {
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-table-wrap {
    overflow: auto;
  }

  .dashboard-theme .tax-purchase-province-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-width: 980px;
  }

  .dashboard-theme .tax-purchase-province-master-pane,
  .dashboard-theme .tax-purchase-province-detail-pane {
    min-height: 260px;
  }
}

/* ========================================================================== */
/* Ajustes de legibilidad y selección homogénea de filas                      */
/* ========================================================================== */
/* El subdiario de Compras sin imputaciones aprovecha todo el ancho disponible
   sin sacrificar las 17 columnas. Se aumenta la tipografía respecto de la
   primera versión compacta y se redistribuyen los anchos para dar prioridad a
   comprobante, proveedor y CUIT. */
@media (min-width: 1180px) {
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-table-wrap .tax-purchase-journal-table:not(.has-imputations) {
    font-size: .61rem;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) th,
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) td {
    padding: 4px 2px;
    line-height: 1.14;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) th {
    font-size: .57rem;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) th button {
    gap: 2px;
    min-height: 24px;
    line-height: 1.04;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="journal"] .tax-purchase-journal-table:not(.has-imputations) td {
    font-size: .61rem;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
  }

  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(1),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(1) { width: 4.4%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(2),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(2) { width: 5.6%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(3),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(3) { width: 10.4%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(4),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(4) { width: 13.2%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(5),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(5) { width: 8.4%; }
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) th:nth-child(n+6),
  .dashboard-theme .tax-purchase-journal-table:not(.has-imputations) td:nth-child(n+6) { width: 4.8%; }
}

/* Compras por provincia: el panel maestro queda deliberadamente más angosto
   para que el detalle sea el protagonista una vez seleccionada una provincia. */
@media (min-width: 1180px) {
  .dashboard-theme .tax-purchase-province-layout {
    grid-template-columns: minmax(430px, .68fr) minmax(0, 1.32fr);
    gap: 9px;
  }

  .dashboard-theme .tax-purchase-province-master-table {
    min-width: 570px !important;
  }

  .dashboard-theme .tax-purchase-province-detail-table {
    width: 100%;
    min-width: 860px !important;
  }

  .dashboard-theme .tax-purchase-province-master-table th,
  .dashboard-theme .tax-purchase-province-master-table td {
    padding-inline: 4px;
  }

  .dashboard-theme .tax-purchase-province-master-table th {
    font-size: .50rem;
  }

  .dashboard-theme .tax-purchase-province-master-table td {
    font-size: .55rem;
  }

  .dashboard-theme .tax-purchase-province-detail-table th {
    font-size: .55rem;
  }

  .dashboard-theme .tax-purchase-province-detail-table td {
    font-size: .62rem;
  }
}

/* Selección de filas única para todo el dashboard.
   Replica literalmente la convención de Contabilidad General: fondo neutro y
   barra naranja recta de 3 px en el borde izquierdo, sin esquinas redondeadas. */
.dashboard-theme table tbody tr.is-selected > td {
  background: var(--data-table-selected) !important;
  color: var(--data-table-text);
  border-radius: 0 !important;
}

.dashboard-theme table tbody tr.is-selected > td:first-child {
  position: relative;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.dashboard-theme table tbody tr.is-selected > td:first-child::before {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  border-radius: 0;
  background: var(--data-table-selected-accent);
  content: "";
  pointer-events: none;
}

/* ========================================================================== */
/* Compras por provincia · ajuste fino de anchos maestro/detalle              */
/* ========================================================================== */
@media (min-width: 1180px) {
  /* El maestro sólo necesita contexto para elegir mes/provincia; el detalle
     recibe el ancho principal una vez seleccionada la fila. */
  .dashboard-theme .tax-purchase-province-layout {
    grid-template-columns: minmax(360px, .56fr) minmax(0, 1.44fr);
    gap: 8px;
  }

  .dashboard-theme .tax-purchase-province-master-table {
    width: 100%;
    min-width: 515px !important;
    table-layout: fixed;
  }

  .dashboard-theme .tax-purchase-province-master-table th,
  .dashboard-theme .tax-purchase-province-master-table td {
    padding-inline: 3px;
  }

  .dashboard-theme .tax-purchase-province-master-table th:nth-child(1),
  .dashboard-theme .tax-purchase-province-master-table td:nth-child(1) { width: 12%; }
  .dashboard-theme .tax-purchase-province-master-table th:nth-child(2),
  .dashboard-theme .tax-purchase-province-master-table td:nth-child(2) { width: 18%; }
  .dashboard-theme .tax-purchase-province-master-table th:nth-child(3),
  .dashboard-theme .tax-purchase-province-master-table td:nth-child(3) { width: 14%; }
  .dashboard-theme .tax-purchase-province-master-table th:nth-child(4),
  .dashboard-theme .tax-purchase-province-master-table td:nth-child(4) { width: 12%; }
  .dashboard-theme .tax-purchase-province-master-table th:nth-child(5),
  .dashboard-theme .tax-purchase-province-master-table td:nth-child(5) { width: 12%; }
  .dashboard-theme .tax-purchase-province-master-table th:nth-child(6),
  .dashboard-theme .tax-purchase-province-master-table td:nth-child(6) { width: 12%; }
  .dashboard-theme .tax-purchase-province-master-table th:nth-child(7),
  .dashboard-theme .tax-purchase-province-master-table td:nth-child(7) { width: 14%; }
  .dashboard-theme .tax-purchase-province-master-table th:nth-child(8),
  .dashboard-theme .tax-purchase-province-master-table td:nth-child(8) { width: 6%; }

  /* El detalle ya dispone de más ancho, por lo que se compactan especialmente
     Comprobante y Proveedor y se redistribuye el sobrante a importes. */
  .dashboard-theme .tax-purchase-province-detail-table {
    width: 100%;
    min-width: 790px !important;
    table-layout: fixed;
  }

  .dashboard-theme .tax-purchase-province-detail-table th,
  .dashboard-theme .tax-purchase-province-detail-table td {
    padding-inline: 4px;
  }

  .dashboard-theme .tax-purchase-province-detail-table th:nth-child(1),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(1) { width: 7%; }
  .dashboard-theme .tax-purchase-province-detail-table th:nth-child(2),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(2) { width: 15%; }
  .dashboard-theme .tax-purchase-province-detail-table th:nth-child(3),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(3) { width: 20%; }
  .dashboard-theme .tax-purchase-province-detail-table th:nth-child(4),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(4) { width: 11%; }
  .dashboard-theme .tax-purchase-province-detail-table th:nth-child(5),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(5) { width: 10%; }
  .dashboard-theme .tax-purchase-province-detail-table th:nth-child(6),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(6) { width: 8%; }
  .dashboard-theme .tax-purchase-province-detail-table th:nth-child(7),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(7) { width: 10%; }
  .dashboard-theme .tax-purchase-province-detail-table th:nth-child(8),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(8) { width: 8%; }
  .dashboard-theme .tax-purchase-province-detail-table th:nth-child(9),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(9) { width: 11%; }

  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(2),
  .dashboard-theme .tax-purchase-province-detail-table td:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ========================================================================== */
/* Compras · cabeceras compactas y Subdiario con imputaciones maestro-detalle */
/* ========================================================================== */
.dashboard-theme .tax-compact-panel-heading,
.dashboard-theme .tax-purchase-province-master-heading.tax-compact-panel-heading,
.dashboard-theme .tax-purchase-province-detail-heading.tax-compact-panel-heading {
  display: flex;
  min-height: 30px;
  padding: 5px 8px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-theme .tax-compact-panel-heading-main,
.dashboard-theme .tax-purchase-province-master-heading .tax-compact-panel-heading-main,
.dashboard-theme .tax-purchase-province-detail-heading .tax-compact-panel-heading-main {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
}

.dashboard-theme .tax-compact-panel-heading .eyebrow {
  flex: 0 0 auto;
  margin: 0;
  font-size: .50rem;
  line-height: 1;
}

.dashboard-theme .tax-compact-panel-heading h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: .69rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .tax-compact-panel-meta {
  flex: 0 0 auto;
  color: #6e7d78;
  font-size: .55rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-theme .tax-purchase-table-wrap.has-imputation-layout {
  overflow: hidden;
}

.dashboard-theme .tax-purchase-journal-imputation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(390px, .82fr);
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.dashboard-theme .tax-purchase-journal-master-pane,
.dashboard-theme .tax-purchase-journal-detail-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dbe5e1;
  border-radius: 11px;
  background: #fff;
}

.dashboard-theme .tax-purchase-journal-detail-pane {
  background: #f9fbfa;
}

.dashboard-theme .tax-purchase-journal-master-heading,
.dashboard-theme .tax-purchase-journal-detail-heading {
  flex: 0 0 auto;
  border-bottom: 1px solid #e2e8e5;
}

.dashboard-theme .tax-purchase-journal-master-table-wrap,
.dashboard-theme .tax-purchase-journal-detail-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.dashboard-theme .tax-purchase-journal-master-table,
.dashboard-theme .tax-purchase-journal-imputation-table {
  width: 100%;
  table-layout: fixed;
}

.dashboard-theme .tax-purchase-journal-master-table {
  min-width: 740px !important;
}

.dashboard-theme .tax-purchase-journal-master-table th,
.dashboard-theme .tax-purchase-journal-master-table td {
  min-width: 0 !important;
  padding: 5px 5px;
}

.dashboard-theme .tax-purchase-journal-master-table th {
  font-size: .53rem;
}

.dashboard-theme .tax-purchase-journal-master-table td {
  overflow: hidden;
  font-size: .61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .tax-purchase-journal-master-table th:nth-child(1),
.dashboard-theme .tax-purchase-journal-master-table td:nth-child(1) { width: 9%; }
.dashboard-theme .tax-purchase-journal-master-table th:nth-child(2),
.dashboard-theme .tax-purchase-journal-master-table td:nth-child(2) { width: 9%; }
.dashboard-theme .tax-purchase-journal-master-table th:nth-child(3),
.dashboard-theme .tax-purchase-journal-master-table td:nth-child(3) { width: 20%; }
.dashboard-theme .tax-purchase-journal-master-table th:nth-child(4),
.dashboard-theme .tax-purchase-journal-master-table td:nth-child(4) { width: 25%; }
.dashboard-theme .tax-purchase-journal-master-table th:nth-child(5),
.dashboard-theme .tax-purchase-journal-master-table td:nth-child(5) { width: 15%; }
.dashboard-theme .tax-purchase-journal-master-table th:nth-child(6),
.dashboard-theme .tax-purchase-journal-master-table td:nth-child(6) { width: 11%; }
.dashboard-theme .tax-purchase-journal-master-table th:nth-child(7),
.dashboard-theme .tax-purchase-journal-master-table td:nth-child(7) { width: 11%; }

.dashboard-theme .tax-purchase-journal-row {
  cursor: pointer;
}

.dashboard-theme .tax-purchase-journal-row:hover > td {
  background: #f7f7f4;
}

.dashboard-theme .tax-purchase-journal-row:focus-visible {
  outline: 2px solid rgba(245, 159, 47, .55);
  outline-offset: -2px;
}

.dashboard-theme .tax-purchase-journal-detail-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(110px, .75fr) minmax(95px, .7fr) minmax(105px, .7fr);
  flex: 0 0 auto;
  gap: 0;
  border-bottom: 1px solid #e2e8e5;
  background: #fff;
}

.dashboard-theme .tax-purchase-journal-detail-summary > div {
  display: grid;
  min-width: 0;
  gap: 1px;
  padding: 5px 7px;
  border-right: 1px solid #edf1ef;
}

.dashboard-theme .tax-purchase-journal-detail-summary > div:last-child {
  border-right: 0;
}

.dashboard-theme .tax-purchase-journal-detail-summary span {
  color: #798681;
  font-size: .48rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.dashboard-theme .tax-purchase-journal-detail-summary strong {
  overflow: hidden;
  color: #263136;
  font-size: .60rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .tax-purchase-journal-imputation-table {
  min-width: 610px !important;
}

.dashboard-theme .tax-purchase-journal-imputation-table th,
.dashboard-theme .tax-purchase-journal-imputation-table td {
  min-width: 0 !important;
  padding: 5px 5px;
}

.dashboard-theme .tax-purchase-journal-imputation-table th {
  font-size: .52rem;
}

.dashboard-theme .tax-purchase-journal-imputation-table td {
  font-size: .59rem;
}

.dashboard-theme .tax-purchase-journal-imputation-table th:nth-child(1),
.dashboard-theme .tax-purchase-journal-imputation-table td:nth-child(1) { width: 42%; }
.dashboard-theme .tax-purchase-journal-imputation-table th:nth-child(2),
.dashboard-theme .tax-purchase-journal-imputation-table td:nth-child(2) { width: 17%; }
.dashboard-theme .tax-purchase-journal-imputation-table th:nth-child(3),
.dashboard-theme .tax-purchase-journal-imputation-table td:nth-child(3) { width: 17%; }
.dashboard-theme .tax-purchase-journal-imputation-table th:nth-child(4),
.dashboard-theme .tax-purchase-journal-imputation-table td:nth-child(4) { width: 24%; }

.dashboard-theme .tax-purchase-journal-imputation-table td:nth-child(1),
.dashboard-theme .tax-purchase-journal-imputation-table td:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1179px) {
  .dashboard-theme .tax-purchase-table-wrap.has-imputation-layout {
    overflow: auto;
  }

  .dashboard-theme .tax-purchase-journal-imputation-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-width: 980px;
  }

  .dashboard-theme .tax-purchase-journal-master-pane,
  .dashboard-theme .tax-purchase-journal-detail-pane {
    min-height: 260px;
  }
}

/* ========================================================================== */
/* Impuestos · Compras por provincia · legibilidad y datos sin recortes       */
/* ========================================================================== */
/*
   En el maestro/detalle anterior el maestro quedaba demasiado angosto y ambas
   tablas se forzaban con table-layout: fixed, lo que reducía la tipografía y
   terminaba truncando importes, comprobantes y proveedores. Cada panel conserva
   ahora su propio scroll horizontal y las columnas mantienen un ancho mínimo
   legible, sin usar elipsis para ocultar datos.
*/
@media (min-width: 1180px) {
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-table-wrap {
    overflow: hidden;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-layout {
    grid-template-columns: minmax(520px, .82fr) minmax(0, 1.18fr);
    gap: 10px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table-wrap,
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table-wrap {
    overflow: auto;
    scrollbar-gutter: stable;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table {
    width: 100%;
    min-width: 840px !important;
    table-layout: auto;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table {
    width: 100%;
    min-width: 1100px !important;
    table-layout: auto;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] :is(.tax-purchase-province-master-table, .tax-purchase-province-detail-table) th,
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] :is(.tax-purchase-province-master-table, .tax-purchase-province-detail-table) td {
    width: auto !important;
    padding: 6px 7px;
    line-height: 1.18;
    white-space: nowrap;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] :is(.tax-purchase-province-master-table, .tax-purchase-province-detail-table) th {
    font-size: .61rem;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] :is(.tax-purchase-province-master-table, .tax-purchase-province-detail-table) th button {
    min-height: 24px;
    gap: 4px;
    line-height: 1.08;
    white-space: nowrap;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] :is(.tax-purchase-province-master-table, .tax-purchase-province-detail-table) td {
    overflow: visible;
    font-size: .67rem;
    text-overflow: clip;
    font-variant-numeric: tabular-nums;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(1) { min-width: 74px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(2) { min-width: 118px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(3) { min-width: 112px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(4) { min-width: 104px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(5) { min-width: 105px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(6) { min-width: 110px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(7) { min-width: 122px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(8) { min-width: 72px !important; }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table :is(th, td):nth-child(1) { min-width: 86px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table :is(th, td):nth-child(2) { min-width: 154px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table :is(th, td):nth-child(3) { min-width: 205px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table :is(th, td):nth-child(4) { min-width: 126px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table :is(th, td):nth-child(5) { min-width: 112px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table :is(th, td):nth-child(6) { min-width: 96px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table :is(th, td):nth-child(7) { min-width: 112px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table :is(th, td):nth-child(8) { min-width: 102px !important; }
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table :is(th, td):nth-child(9) { min-width: 120px !important; }
}

/* ========================================================================== */
/* Compras por provincia · navegación en 3 niveles                            */
/* Provincia (50%) + Mes (50%) arriba; detalle de comprobantes al 100% abajo. */
/* ========================================================================== */
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-table-wrap {
  overflow: hidden;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(170px, .82fr) minmax(225px, 1.18fr);
  gap: 8px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.dashboard-theme .tax-purchase-province-month-pane,
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-pane,
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dbe5e1;
  border-radius: 11px;
  background: #fff;
}

.dashboard-theme .tax-purchase-province-month-pane {
  background: #fbfcfb;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-pane {
  grid-column: 1 / -1;
  background: #f9fbfa;
}

.dashboard-theme .tax-purchase-province-month-heading {
  flex: 0 0 auto;
  border-bottom: 1px solid #e2e8e5;
}

.dashboard-theme .tax-purchase-province-month-table-wrap,
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table-wrap,
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table,
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-month-table {
  width: 100%;
  min-width: 710px !important;
  table-layout: auto;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table {
  width: 100%;
  min-width: 1040px !important;
  table-layout: auto;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] :is(.tax-purchase-province-master-table, .tax-purchase-province-month-table, .tax-purchase-province-detail-table) th,
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] :is(.tax-purchase-province-master-table, .tax-purchase-province-month-table, .tax-purchase-province-detail-table) td {
  width: auto !important;
  padding: 5px 6px;
  line-height: 1.14;
  white-space: nowrap;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] :is(.tax-purchase-province-master-table, .tax-purchase-province-month-table) th {
  font-size: .55rem;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] :is(.tax-purchase-province-master-table, .tax-purchase-province-month-table) td {
  overflow: visible;
  font-size: .62rem;
  text-overflow: clip;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table th {
  font-size: .58rem;
}

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-table td {
  overflow: visible;
  font-size: .65rem;
  text-overflow: clip;
  font-variant-numeric: tabular-nums;
}

/* Anchos mínimos legibles para las dos tablas superiores. */
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(1) { min-width: 122px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(2) { min-width: 105px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(3) { min-width: 96px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(4) { min-width: 100px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(5) { min-width: 102px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(6) { min-width: 116px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-table :is(th, td):nth-child(7) { min-width: 68px !important; }

.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-month-table :is(th, td):nth-child(1) { min-width: 78px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-month-table :is(th, td):nth-child(2) { min-width: 108px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-month-table :is(th, td):nth-child(3) { min-width: 96px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-month-table :is(th, td):nth-child(4) { min-width: 100px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-month-table :is(th, td):nth-child(5) { min-width: 102px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-month-table :is(th, td):nth-child(6) { min-width: 116px !important; }
.dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-month-table :is(th, td):nth-child(7) { min-width: 68px !important; }

.dashboard-theme .tax-purchase-province-month-row {
  cursor: pointer;
}

.dashboard-theme .tax-purchase-province-month-row:hover > td {
  background: #f7f7f4;
}

.dashboard-theme .tax-purchase-province-month-row:focus-visible {
  outline: 2px solid rgba(245, 159, 47, .55);
  outline-offset: -2px;
}

/* El filtro de este reporte entra en una sola línea útil en pantallas grandes. */
@media (min-width: 1180px) {
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-report-workspace {
    gap: 7px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .accounting-imputation-filter-toolbar.tax-filter-toolbar {
    min-height: 35px;
    padding-block: 2px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .accounting-imputation-filter-toggle {
    min-height: 27px;
    padding-block: 2px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .accounting-imputation-search-persistent input {
    min-height: 28px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-filter-body {
    padding: 3px 8px 4px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-filter-grid {
    grid-template-columns: minmax(230px, 1.2fr) minmax(132px, .68fr) minmax(132px, .68fr) minmax(300px, 1.35fr) minmax(190px, .9fr);
    gap: 4px 7px;
    padding-top: 3px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-fields:not([hidden]) {
    display: contents !important;
    grid-column: auto !important;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-filter-grid > label,
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-fields > label {
    gap: 1px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-filter-grid label > span,
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-sales-radio-group legend {
    font-size: .52rem;
    line-height: 1;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-filter-grid > label > :is(input, select),
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-fields > label > select {
    min-height: 27px;
    height: 27px;
    padding-block: 3px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-sales-radio-group {
    align-self: end;
    min-height: 37px;
    padding: 3px 7px 4px;
    gap: 3px 10px;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"][data-tax-purchase-state="success"] .tax-query-state {
    display: none;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-results {
    padding: 7px;
  }
}

@media (max-width: 1179px) {
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-table-wrap {
    overflow: auto;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    width: 100%;
    height: auto;
    min-width: 0;
  }

  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-pane {
    grid-column: auto;
  }

  .dashboard-theme .tax-purchase-province-month-pane,
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-master-pane,
  .dashboard-theme .tax-purchase-report-card.is-widget-maximized[data-tax-purchase-report-type="province"] .tax-purchase-province-detail-pane {
    min-height: 230px;
  }
}

/* ========================================================================== */
/* Navegación v3 — grupos tipográficos + módulos en mosaico                   */
/* ========================================================================== */

/* Las agrupaciones son separadores de navegación: no llevan icono. */
.dashboard-theme .dashboard-nav-group-toggle,
.dashboard-theme.sidebar-expanded .dashboard-nav-group-toggle,
.dashboard-theme.sidebar-collapsed .dashboard-nav-group-toggle {
  min-height: 25px;
  padding: 4px 6px 3px;
  gap: 5px;
  border-radius: 7px;
  color: rgba(250, 247, 239, .58);
  background: transparent;
}

.dashboard-theme .dashboard-nav-group-toggle:hover,
.dashboard-theme .dashboard-nav-group-toggle:focus-visible,
.dashboard-theme .dashboard-nav-group.is-open .dashboard-nav-group-toggle {
  color: rgba(250, 247, 239, .96);
  background: rgba(255, 255, 255, .035);
}

.dashboard-theme .dashboard-nav-group.has-active .dashboard-nav-group-label {
  color: #f2a332;
}

.dashboard-theme .dashboard-nav-group-label,
.dashboard-theme.sidebar-expanded .dashboard-nav-group-label,
.dashboard-theme.sidebar-collapsed .dashboard-nav-group-label {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  overflow: visible;
  color: inherit;
  font-size: .49rem;
  font-weight: 900;
  line-height: 1.08;
  text-align: left;
  text-overflow: clip;
  text-transform: uppercase;
  letter-spacing: .085em;
  white-space: normal;
}

.dashboard-theme .dashboard-nav-group-chevron {
  width: 6px;
  height: 6px;
  flex-basis: 6px;
  margin-right: 1px;
}

/* Los módulos son los elementos visuales principales. */
.dashboard-theme .dashboard-nav-group-items,
.dashboard-theme.sidebar-expanded .dashboard-nav-group-items,
.dashboard-theme.sidebar-collapsed .dashboard-nav-group-items {
  min-width: 0;
  padding: 4px 0 2px;
  gap: 4px;
}

.dashboard-theme .dashboard-nav-group-items .dashboard-nav-button,
.dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button,
.dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 58px;
  padding: 6px 3px 5px;
  border-radius: 12px;
  font-size: .52rem;
  font-weight: 800;
  line-height: 1.08;
  text-align: center;
}

.dashboard-theme .dashboard-nav-group-items .dashboard-nav-button .ui-icon,
.dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button .ui-icon,
.dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button .ui-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.dashboard-theme .dashboard-nav-group-items .dashboard-nav-button > span:last-child,
.dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button > span:last-child,
.dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button > span:last-child {
  display: -webkit-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* Configuración también es un módulo: icono arriba y descripción debajo. */
.dashboard-theme .dashboard-sidebar-foot,
.dashboard-theme.sidebar-expanded .dashboard-sidebar-foot,
.dashboard-theme.sidebar-collapsed .dashboard-sidebar-foot {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 7px 4px 2px;
  text-align: center;
  line-height: 1.08;
}

.dashboard-theme .dashboard-sidebar-foot .ui-icon,
.dashboard-theme.sidebar-expanded .dashboard-sidebar-foot .ui-icon,
.dashboard-theme.sidebar-collapsed .dashboard-sidebar-foot .ui-icon {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
}

.dashboard-theme .dashboard-sidebar-foot > span:last-child,
.dashboard-theme.sidebar-expanded .dashboard-sidebar-foot > span:last-child,
.dashboard-theme.sidebar-collapsed .dashboard-sidebar-foot > span:last-child {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

/* Escritorio expandido: dos módulos por fila para ganar altura útil. */
@media (min-width: 1180px) {
  .dashboard-theme.sidebar-expanded .dashboard-nav-group + .dashboard-nav-group {
    margin-top: 5px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-toggle {
    min-height: 24px;
    padding: 4px 5px 3px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-label {
    font-size: .50rem;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 6px;
    padding: 4px 0 3px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button {
    width: 100%;
    min-height: 67px;
    padding: 7px 4px 6px;
    gap: 5px;
    border-radius: 12px;
    font-size: .55rem;
    line-height: 1.08;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button .ui-icon {
    width: 27px;
    height: 27px;
    flex-basis: 27px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button:only-child {
    grid-column: 1 / -1;
    width: calc(50% - 3px);
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot {
    min-height: 61px;
    padding: 8px 4px 2px;
    gap: 5px;
    font-size: .56rem;
    text-align: center;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot .ui-icon {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }
}

/* Rail compacto/tablet: se conserva el concepto icono + nombre debajo. */
@media (min-width: 768px) {
  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-toggle,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-toggle {
    min-height: 27px;
    padding: 4px 1px;
    justify-content: center;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-label,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-label {
    display: block;
    flex: 1 1 auto;
    font-size: .40rem;
    line-height: 1.02;
    text-align: center;
    letter-spacing: .025em;
    white-space: normal;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-chevron,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-chevron {
    display: none;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button {
    min-height: 57px;
    padding: 5px 2px;
    gap: 4px;
    font-size: .45rem;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-items .dashboard-nav-button .ui-icon,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button .ui-icon {
    width: 23px;
    height: 23px;
    flex-basis: 23px;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-sidebar-foot,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar-foot {
    min-height: 58px;
    gap: 4px;
    font-size: .45rem;
  }
}

/* Móvil: el drawer aprovecha el ancho con dos accesos por fila. */
@media (max-width: 767px) {
  .dashboard-theme .dashboard-nav-group-toggle,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-toggle,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-toggle {
    min-height: 29px;
    padding: 5px 6px 4px;
  }

  .dashboard-theme .dashboard-nav-group-label,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-label,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-label {
    font-size: .50rem;
  }

  .dashboard-theme .dashboard-nav-group-items,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 5px 0 4px;
  }

  .dashboard-theme .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button {
    min-height: 67px;
    padding: 7px 5px;
    gap: 5px;
    font-size: .56rem;
    text-align: center;
  }

  .dashboard-theme .dashboard-nav-group-items .dashboard-nav-button .ui-icon,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button .ui-icon,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button .ui-icon {
    width: 27px;
    height: 27px;
    flex-basis: 27px;
  }

  .dashboard-theme .dashboard-nav-group-items .dashboard-nav-button:only-child,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button:only-child,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button:only-child {
    grid-column: 1 / -1;
    width: calc(50% - 3px);
  }
}

/* ========================================================================== */
/* Navegación v4 — barra angosta + módulos apilados                           */
/* ========================================================================== */
/* La agrupación sigue siendo sólo un rótulo. Cada módulo ocupa una fila, con
   el icono arriba y la descripción debajo. La barra expandida no necesita el
   ancho del mosaico anterior. */
.dashboard-theme {
  --adaptive-sidebar-expanded-width: 124px;
}

@media (min-width: 1180px) {
  .dashboard-theme.sidebar-expanded .dashboard-sidebar {
    width: var(--adaptive-sidebar-expanded-width);
    padding-right: 9px;
    padding-left: 9px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-brand {
    justify-content: center;
    width: 48px;
    height: 44px;
    margin-right: auto;
    margin-left: auto;
    padding: 6px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-brand-name {
    display: none;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group + .dashboard-nav-group {
    margin-top: 4px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-toggle {
    min-height: 30px;
    padding: 4px 3px 3px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-label {
    font-size: .55rem;
    letter-spacing: .025em;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    gap: 3px;
    width: 100%;
    padding: 3px 0 2px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 58px;
    padding: 6px 4px 5px;
    border-radius: 11px;
    font-size: .75rem;
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button .ui-icon,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button .ui-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button > span:last-child,
  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button > span:last-child {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    text-align: center;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button:only-child {
    width: 100%;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 58px;
    padding: 7px 3px 2px;
    font-size: .75rem;
    line-height: 1.2;
    text-align: center;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot .ui-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
  }

  .dashboard-theme.sidebar-expanded .dashboard-sidebar-foot > span:last-child {
    display: block;
    max-width: 100%;
    overflow: visible;
    text-align: center;
    text-overflow: ellipsis;
    white-space: normal;
  }
}

/* En móvil se conserva el mismo criterio: un módulo debajo del otro. */
@media (max-width: 767px) {
  .dashboard-theme .dashboard-nav-group-items,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
  }

  .dashboard-theme .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme .dashboard-nav-group-items .dashboard-nav-button:only-child,
  .dashboard-theme.sidebar-expanded .dashboard-nav-group-items .dashboard-nav-button:only-child,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-items .dashboard-nav-button:only-child {
    width: 100%;
  }
}

/* Balanced icon sizing also applies to the compact rail and phone drawer. */
.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button .ui-icon,
.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot .ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

@media (min-width: 768px) {
  .dashboard-theme:not(.sidebar-expanded) .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button,
  .dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button {
    font-size: .625rem;
    font-weight: 650;
    line-height: 1.2;
  }

  .dashboard-theme:not(.sidebar-expanded) .dashboard-nav-group-label,
  .dashboard-theme.sidebar-collapsed .dashboard-nav-group-label {
    font-size: .53rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 767px) {
  /* Override the legacy horizontal tab flex-basis in the vertical drawer. */
  .dashboard-theme .dashboard-sidebar .dashboard-nav-group-toggle {
    flex: 0 0 auto;
    min-height: 44px;
  }

  .dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button {
    min-height: 58px;
    font-size: .875rem;
    font-weight: 650;
    line-height: 1.2;
  }
}

/* ========================================================================== */
/* Navegación v5 — lista directa / rail con flyout / drawer móvil             */
/* ========================================================================== */
/* Esta capa reemplaza las variantes de navegación anteriores. En escritorio
   amplio no se muestran categorías: todos los módulos son accesos directos.
   Las categorías aparecen únicamente como mecanismo de compactación cuando
   falta ancho o altura, y como rótulos de lectura dentro del drawer móvil. */
body.dashboard-theme {
  --nav-wide-width: 242px;
  --nav-rail-width: 72px;
  --nav-left: 18px;
  --nav-gap: 18px;
}

body.dashboard-theme .dashboard-sidebar-toggle {
  display: none !important;
}

body.dashboard-theme .dashboard-brand-logo-frame {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
}

body.dashboard-theme .dashboard-brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}


body.dashboard-theme .dashboard-brand-logo {
  border-radius: 6px;
}

body.dashboard-theme .dashboard-brand-logo[hidden],
body.dashboard-theme [data-dashboard-brand-fallback][hidden] {
  display: none !important;
}

body.dashboard-theme .dashboard-nav-section-heading,
body.dashboard-theme .dashboard-nav-flyout-title {
  display: none;
}

/* Escritorio amplio: una sola lista de módulos, sin encabezados de sección. */
@media (min-width: 1400px) and (min-height: 760px) {
  body.dashboard-theme .app-shell,
  body.dashboard-theme.sidebar-expanded .app-shell,
  body.dashboard-theme.sidebar-collapsed .app-shell {
    padding: 18px 20px 36px calc(var(--nav-left) + var(--nav-wide-width) + var(--nav-gap));
  }

  body.dashboard-theme .dashboard-sidebar,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar {
    position: fixed;
    z-index: 1200;
    top: 18px;
    bottom: 18px;
    left: var(--nav-left);
    display: flex;
    width: var(--nav-wide-width);
    height: auto;
    margin: 0;
    padding: 13px 12px 11px;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 24px;
    color: #faf7ef;
    background: linear-gradient(180deg, #11181c 0%, #151d21 100%);
    box-shadow: 0 16px 42px rgba(13,30,27,.14);
  }

  body.dashboard-theme .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
  }

  body.dashboard-theme .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    display: flex;
    width: 100%;
    height: 48px;
    margin: 0 0 5px;
    padding: 4px 7px;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    color: #faf7ef;
    background: transparent;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {
    width: 46px;
    height: 38px;
    flex: 0 0 46px;
    padding: 3px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px;
    background: #fff;
  }

  body.dashboard-theme .dashboard-brand-mark,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-mark,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-mark {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    overflow: visible;
    color: #fff;
    background: transparent;
    opacity: 1;
    font-size: .69rem;
    font-weight: 950;
    letter-spacing: -.02em;
  }

  body.dashboard-theme .dashboard-brand-name,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-name,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-name {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: #faf7ef;
    font-size: .90rem;
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: .015em;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
  }

  body.dashboard-theme .dashboard-sidebar-mobile-close {
    display: none !important;
  }

  body.dashboard-theme .dashboard-sidebar .tab-strip,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .tab-strip,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .tab-strip {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    min-height: 0;
    padding: 1px 3px 6px 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.22) transparent;
  }

  body.dashboard-theme .dashboard-sidebar .tab-strip::-webkit-scrollbar {
    display: block;
    width: 4px;
  }

  body.dashboard-theme .dashboard-sidebar .tab-strip::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255,255,255,.20);
  }

  body.dashboard-theme .dashboard-nav-primary {
    margin-bottom: 3px;
  }

  body.dashboard-theme .dashboard-nav-section,
  body.dashboard-theme.sidebar-expanded .dashboard-nav-section,
  body.dashboard-theme.sidebar-collapsed .dashboard-nav-section {
    position: static;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
  }

  body.dashboard-theme .dashboard-nav-primary + .dashboard-nav-section,
  body.dashboard-theme .dashboard-nav-section + .dashboard-nav-section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,.13);
  }

  body.dashboard-theme .dashboard-nav-group-toggle,
  body.dashboard-theme .dashboard-nav-section-heading,
  body.dashboard-theme .dashboard-nav-flyout-title {
    display: none !important;
  }

  body.dashboard-theme .dashboard-nav-group-items,
  body.dashboard-theme.sidebar-expanded .dashboard-nav-group-items,
  body.dashboard-theme.sidebar-collapsed .dashboard-nav-group-items {
    position: static;
    display: flex !important;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button,
  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 0;
    border-radius: 11px;
    color: rgba(250,247,239,.80);
    background: transparent;
    box-shadow: none;
    font-size: .79rem;
    font-weight: 700;
    line-height: 1.20;
    text-align: left;
    white-space: normal;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button .ui-icon,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button .ui-icon,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button .ui-icon,
  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button .ui-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button > span:last-child,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button > span:last-child,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button > span:last-child {
    display: block;
    max-width: none;
    overflow: visible;
    text-align: left;
    text-overflow: clip;
    white-space: normal;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button:hover {
    color: #fff;
    background: rgba(255,255,255,.075);
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button.is-active {
    color: #11181c;
    background: linear-gradient(145deg, #fffdf8 0%, #f4eee3 100%);
    box-shadow: inset 0 -2px 0 rgba(245,159,47,.70), 0 5px 14px rgba(0,0,0,.08);
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;
    width: 100%;
    min-height: 46px;
    margin: 6px 0 0;
    padding: 9px 10px 3px;
    border-top: 1px solid rgba(255,255,255,.16);
    border-radius: 0 0 11px 11px;
    color: rgba(250,247,239,.82);
    background: transparent;
    font-size: .79rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot > span:last-child {
    display: block;
    max-width: none;
    overflow: visible;
    text-align: left;
    white-space: normal;
  }
}

/* Notebook / tablet o escritorio bajo: cuatro decisiones primarias y flyout legible. */
@media (min-width: 768px) and (max-width: 1399px),
       (min-width: 1400px) and (max-height: 759px) {
  body.dashboard-theme .app-shell,
  body.dashboard-theme.sidebar-expanded .app-shell,
  body.dashboard-theme.sidebar-collapsed .app-shell {
    padding: 18px 20px 36px calc(var(--nav-left) + var(--nav-rail-width) + var(--nav-gap));
  }

  body.dashboard-theme .dashboard-sidebar,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar {
    position: fixed;
    z-index: 1200;
    top: 18px;
    bottom: 18px;
    left: var(--nav-left);
    display: flex;
    width: var(--nav-rail-width);
    height: auto;
    margin: 0;
    padding: 10px 8px;
    align-items: stretch;
    overflow: visible;
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 22px;
    color: #faf7ef;
    background: linear-gradient(180deg, #11181c 0%, #151d21 100%);
    box-shadow: 0 14px 34px rgba(13,30,27,.14);
  }

  body.dashboard-theme .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  body.dashboard-theme .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    display: grid;
    width: 50px;
    height: 50px;
    margin: 0 0 12px;
    padding: 5px;
    place-items: center;
    overflow: hidden;
    border: 0;
    border-radius: 15px;
    background: rgba(255,255,255,.07);
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {
    width: 40px;
    height: 40px;
    padding: 3px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 11px;
    background: #fff;
  }

  body.dashboard-theme .dashboard-brand-mark,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-mark,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-mark {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    overflow: visible;
    color: #fff;
    background: transparent;
    opacity: 1;
    font-size: .66rem;
    font-weight: 950;
  }

  body.dashboard-theme .dashboard-brand-name,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-name,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-name,
  body.dashboard-theme .dashboard-sidebar-mobile-close {
    display: none !important;
  }

  body.dashboard-theme .dashboard-sidebar .tab-strip,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .tab-strip,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .tab-strip {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 7px;
    width: 100%;
    min-height: 0;
    padding: 1px 0;
    overflow: visible !important;
  }

  body.dashboard-theme .dashboard-nav-section,
  body.dashboard-theme.sidebar-expanded .dashboard-nav-section,
  body.dashboard-theme.sidebar-collapsed .dashboard-nav-section {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
  }

  body.dashboard-theme .dashboard-nav-primary,
  body.dashboard-theme .dashboard-nav-group-toggle {
    display: flex !important;
    width: 100%;
    height: 50px;
    min-height: 50px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 14px;
    color: rgba(250,247,239,.78);
    background: transparent;
    box-shadow: none;
    cursor: pointer;
  }

  body.dashboard-theme .dashboard-nav-primary {
    flex: 0 0 50px;
  }

  body.dashboard-theme .dashboard-nav-primary:hover,
  body.dashboard-theme .dashboard-nav-group-toggle:hover,
  body.dashboard-theme .dashboard-nav-group-toggle:focus-visible,
  body.dashboard-theme .dashboard-nav-group.is-flyout-open .dashboard-nav-group-toggle {
    color: #fff;
    background: rgba(255,255,255,.09);
  }

  body.dashboard-theme .dashboard-nav-primary.is-active,
  body.dashboard-theme .dashboard-nav-group.has-active .dashboard-nav-group-toggle {
    color: #fff;
    background: rgba(245,159,47,.20);
    box-shadow: inset 0 0 0 1px rgba(245,159,47,.24);
  }

  body.dashboard-theme .dashboard-nav-primary .ui-icon,
  body.dashboard-theme .dashboard-nav-group-toggle .ui-icon {
    display: block;
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    color: currentColor;
  }

  body.dashboard-theme .dashboard-nav-primary > span:last-child,
  body.dashboard-theme .dashboard-nav-group-label,
  body.dashboard-theme .dashboard-nav-group-chevron,
  body.dashboard-theme .dashboard-nav-section-heading {
    display: none !important;
  }

  body.dashboard-theme .dashboard-nav-group-items,
  body.dashboard-theme.sidebar-expanded .dashboard-nav-group-items,
  body.dashboard-theme.sidebar-collapsed .dashboard-nav-group-items {
    position: absolute;
    z-index: 1420;
    top: -6px;
    left: calc(100% + 15px);
    display: none !important;
    flex-direction: column;
    gap: 3px;
    width: 252px;
    margin: 0;
    padding: 10px;
    overflow: visible;
    border: 1px solid #ddd5c8;
    border-radius: 16px;
    color: #1b2429;
    background: rgba(255,253,248,.985);
    box-shadow: 0 18px 48px rgba(17,24,28,.20);
  }

  body.dashboard-theme .dashboard-nav-group-items::before {
    position: absolute;
    top: 22px;
    left: -6px;
    width: 11px;
    height: 11px;
    border-bottom: 1px solid #ddd5c8;
    border-left: 1px solid #ddd5c8;
    content: "";
    background: #fffdf8;
    transform: rotate(45deg);
  }

  body.dashboard-theme .dashboard-nav-group.is-flyout-open .dashboard-nav-group-items {
    display: flex !important;
  }

  body.dashboard-theme .dashboard-nav-flyout-title {
    display: block;
    margin: 0 1px 4px;
    padding: 4px 7px 8px;
    border-bottom: 1px solid #e7dfd3;
    color: #11181c;
    font-size: .70rem;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: .025em;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 8px 9px;
    border: 0;
    border-radius: 10px;
    color: #313b40;
    background: transparent;
    box-shadow: none;
    font-size: .73rem;
    font-weight: 700;
    line-height: 1.18;
    text-align: left;
    white-space: normal;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button:hover {
    color: #11181c;
    background: #f1ece4;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button.is-active {
    color: #11181c;
    background: #ece4d8;
    box-shadow: inset 3px 0 0 #f59f2f;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button .ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button > span:last-child {
    display: block;
    max-width: none;
    overflow: visible;
    text-align: left;
    text-overflow: clip;
    white-space: normal;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    min-height: 52px;
    margin: 8px 0 0;
    padding: 8px 4px 2px;
    border-top: 1px solid rgba(255,255,255,.16);
    border-radius: 0 0 13px 13px;
    color: rgba(250,247,239,.78);
    background: transparent;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot > span:last-child {
    display: none !important;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot .ui-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
  }
}

/* Teléfono: drawer completo. Las categorías son rótulos de lectura, no pasos. */
@media (max-width: 767px) {
  body.dashboard-theme .dashboard-sidebar,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar {
    width: min(89vw, 340px);
    padding: 14px 12px 12px;
    border: 0;
    border-radius: 0 22px 22px 0;
    color: #172126;
    background: #fffdf8;
    box-shadow: 20px 0 55px rgba(8,18,18,.25);
  }

  body.dashboard-theme .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-header {
    align-items: center;
    min-height: 56px;
    padding: 0 2px 7px;
    border-bottom: 1px solid #e9e1d6;
  }

  body.dashboard-theme .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    display: flex;
    width: auto;
    height: 48px;
    margin: 0;
    padding: 5px 7px;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    border: 0;
    border-radius: 12px;
    color: #11181c;
    background: transparent;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {
    width: 44px;
    height: 34px;
    flex: 0 0 44px;
    padding: 2px 3px;
    border: 1px solid #ddd5c8;
    border-radius: 9px;
    background: #fff;
  }

  body.dashboard-theme .dashboard-brand-mark,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-mark,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-mark {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    overflow: visible;
    color: #11181c;
    background: transparent;
    opacity: 1;
    font-size: .64rem;
    font-weight: 950;
  }

  body.dashboard-theme .dashboard-brand-name,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-name,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-name {
    display: block;
    max-width: 190px;
    overflow: hidden;
    color: #11181c;
    font-size: .86rem;
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: .015em;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
  }

  body.dashboard-theme .dashboard-sidebar-mobile-close {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    margin: 0;
    padding: 0;
    place-items: center;
    border: 1px solid #ddd5c8;
    border-radius: 11px;
    color: #11181c;
    background: #f7f1e8;
  }

  body.dashboard-theme .dashboard-sidebar .tab-strip,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .tab-strip,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .tab-strip {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    min-height: 0;
    padding: 9px 4px 5px 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c9c0b3 transparent;
  }

  body.dashboard-theme .dashboard-nav-primary,
  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-nav-button,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-nav-button,
  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 43px;
    padding: 8px 10px;
    border: 0;
    border-radius: 11px;
    color: #2b353a;
    background: transparent;
    box-shadow: none;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button .ui-icon,
  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button .ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button > span:last-child,
  body.dashboard-theme .dashboard-sidebar .dashboard-nav-group-items .dashboard-nav-button > span:last-child {
    display: block;
    max-width: none;
    overflow: visible;
    color: inherit;
    text-align: left;
    text-overflow: clip;
    white-space: normal;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button:hover {
    color: #11181c;
    background: #f3eee6;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-nav-button.is-active {
    color: #11181c;
    background: #eee7dc;
    box-shadow: inset 3px 0 0 #f59f2f;
  }

  body.dashboard-theme .dashboard-nav-section,
  body.dashboard-theme.sidebar-expanded .dashboard-nav-section,
  body.dashboard-theme.sidebar-collapsed .dashboard-nav-section {
    position: static;
    display: block;
    width: 100%;
    margin: 9px 0 0;
    padding: 9px 0 0;
    border-top: 1px solid #e9e1d6;
  }

  body.dashboard-theme .dashboard-nav-group-toggle {
    display: none !important;
  }

  body.dashboard-theme .dashboard-nav-section-heading {
    display: block;
    padding: 4px 10px 6px;
    color: #7b7165;
    font-size: .55rem;
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: .075em;
    text-transform: uppercase;
  }

  body.dashboard-theme .dashboard-nav-group-items,
  body.dashboard-theme.sidebar-expanded .dashboard-nav-group-items,
  body.dashboard-theme.sidebar-collapsed .dashboard-nav-group-items {
    position: static;
    display: flex !important;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.dashboard-theme .dashboard-nav-flyout-title {
    display: none !important;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .dashboard-sidebar-foot.configuration-launcher {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 47px;
    margin: 8px 0 0;
    padding: 9px 10px 3px;
    border-top: 1px solid #e9e1d6;
    border-radius: 0 0 11px 11px;
    color: #394348;
    background: transparent;
    font-size: .78rem;
    font-weight: 700;
    text-align: left;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot > span:last-child {
    display: block !important;
    max-width: none;
    color: inherit;
    text-align: left;
    white-space: normal;
  }

  body.dashboard-theme .dashboard-sidebar .dashboard-sidebar-foot .ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  body.dashboard-theme .dashboard-mobile-brand-mark.dashboard-brand-logo-frame {
    padding: 4px;
  }

  body.dashboard-theme .dashboard-mobile-brand-mark .dashboard-brand-logo {
    border-radius: 7px;
  }

  body.dashboard-theme .dashboard-mobile-brand-mark [data-dashboard-brand-fallback] {
    color: #11181c;
    font-size: .64rem;
    font-weight: 950;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.dashboard-theme .dashboard-nav-group-items {
    transition: none !important;
  }
}

/* ========================================================================== */
/* Navegación v5.2 — ajuste final de branding                                 */
/* ========================================================================== */
/* La marca usa un PNG transparente. En escritorio amplio se presenta como
   logo + nombre alineados con la navegación; en el rail queda sólo el logo y
   en móvil vuelve a mostrarse el lockup completo. */
@media (min-width: 1400px) and (min-height: 760px) {
  body.dashboard-theme .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-header {
    min-height: 44px;
    justify-content: flex-start !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    width: 100% !important;
    height: 44px !important;
    margin: 0 0 4px !important;
    padding: 2px 7px !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {
    display: grid !important;
    width: 42px !important;
    height: 36px !important;
    flex: 0 0 42px !important;
    padding: 0 !important;
    place-items: center !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo {
    width: 100% !important;
    height: 100% !important;
    max-width: 42px !important;
    max-height: 36px !important;
    object-fit: contain !important;
    border-radius: 0 !important;
  }

  body.dashboard-theme .dashboard-brand-name,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-name,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-name {
    display: block !important;
    min-width: 0 !important;
    max-width: 160px !important;
    overflow: hidden !important;
    color: #faf7ef !important;
    font-size: .93rem !important;
    font-weight: 900 !important;
    line-height: 1.08 !important;
    letter-spacing: .015em !important;
    text-align: left !important;
    text-overflow: ellipsis !important;
    text-transform: none !important;
    white-space: nowrap !important;
  }

  body.dashboard-theme .dashboard-sidebar .tab-strip,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .tab-strip,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .tab-strip {
    padding-top: 0 !important;
  }
}

@media (min-width: 768px) and (max-width: 1399px),
       (min-width: 1400px) and (max-height: 759px) {
  body.dashboard-theme .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    background: transparent !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo {
    border-radius: 0 !important;
  }
}

@media (max-width: 767px) {
  body.dashboard-theme .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-header {
    min-height: 50px !important;
    padding-bottom: 5px !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    height: 44px !important;
    gap: 9px !important;
    padding: 2px 6px !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {
    width: 42px !important;
    height: 34px !important;
    flex: 0 0 42px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    border-radius: 0 !important;
  }

  body.dashboard-theme .dashboard-brand-name,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-name,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-name {
    display: block !important;
    font-size: .88rem !important;
    line-height: 1.1 !important;
  }

  body.dashboard-theme .dashboard-mobile-brand-mark.dashboard-brand-logo-frame {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  body.dashboard-theme .dashboard-mobile-brand-mark .dashboard-brand-logo {
    border-radius: 0 !important;
  }
}
\n\n/* ========================================================================== */\n/* Dashboard navigation v5.3 — brand contrast and scalable logo treatment     */\n/* ========================================================================== */\n/* logoSurface in dashboard-branding.json can be: light | dark | transparent.\n   This keeps the navigation reusable when the dashboard changes company/logo. */\n\nbody.dashboard-theme [data-dashboard-brand][data-dashboard-logo-surface="light"] .dashboard-brand-logo-frame {\n  background: #fffaf3 !important;\n  border: 1px solid rgba(255, 255, 255, .18) !important;\n  box-shadow: 0 1px 0 rgba(255, 255, 255, .08), 0 5px 14px rgba(0, 0, 0, .16) !important;\n}\n\nbody.dashboard-theme [data-dashboard-brand][data-dashboard-logo-surface="dark"] .dashboard-brand-logo-frame {\n  background: #111c21 !important;\n  border: 1px solid rgba(255, 255, 255, .13) !important;\n  box-shadow: none !important;\n}\n\nbody.dashboard-theme [data-dashboard-brand][data-dashboard-logo-surface="transparent"] .dashboard-brand-logo-frame {\n  background: transparent !important;\n  border-color: transparent !important;\n  box-shadow: none !important;\n}\n\n@media (min-width: 1400px) and (min-height: 760px) {\n  body.dashboard-theme .dashboard-sidebar-header,\n  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-header,\n  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-header {\n    min-height: 62px !important;\n    padding: 6px 10px 5px !important;\n  }\n\n  body.dashboard-theme .dashboard-sidebar-brand,\n  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,\n  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {\n    height: 50px !important;\n    gap: 11px !important;\n    padding: 2px 2px !important;\n    align-items: center !important;\n    justify-content: flex-start !important;\n  }\n\n  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {\n    display: grid !important;\n    width: 48px !important;\n    height: 44px !important;\n    flex: 0 0 48px !important;\n    padding: 5px !important;\n    place-items: center !important;\n    overflow: hidden !important;\n    border-radius: 10px !important;\n  }\n\n  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo {\n    width: 100% !important;\n    height: 100% !important;\n    max-width: 38px !important;\n    max-height: 34px !important;\n    object-fit: contain !important;\n  }\n\n  body.dashboard-theme .dashboard-brand-name,\n  body.dashboard-theme.sidebar-expanded .dashboard-brand-name,\n  body.dashboard-theme.sidebar-collapsed .dashboard-brand-name {\n    max-width: 150px !important;\n    font-size: 1rem !important;\n    font-weight: 850 !important;\n    line-height: 1.05 !important;\n    letter-spacing: .01em !important;\n  }\n\n  body.dashboard-theme .dashboard-sidebar .tab-strip,\n  body.dashboard-theme.sidebar-expanded .dashboard-sidebar .tab-strip,\n  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar .tab-strip {\n    padding-top: 0 !important;\n  }\n}\n\n@media (min-width: 768px) and (max-width: 1399px),\n       (min-width: 1400px) and (max-height: 759px) {\n  /* The compact rail deliberately keeps the mark alone; give it contrast too. */\n  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {\n    width: 46px !important;\n    height: 42px !important;\n    padding: 5px !important;\n    overflow: hidden !important;\n    border-radius: 10px !important;\n  }\n\n  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo {\n    max-width: 36px !important;\n    max-height: 32px !important;\n    object-fit: contain !important;\n  }\n}\n\n@media (max-width: 767px) {\n  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {\n    width: 46px !important;\n    height: 42px !important;\n    flex: 0 0 46px !important;\n    padding: 5px !important;\n    overflow: hidden !important;\n    border-radius: 10px !important;\n  }\n\n  body.dashboard-theme .dashboard-mobile-brand-mark.dashboard-brand-logo-frame {\n    width: 38px !important;\n    height: 34px !important;\n    padding: 4px !important;\n    overflow: hidden !important;\n    border-radius: 8px !important;\n  }\n}\n

/* ========================================================================== */
/* Dashboard navigation v5.4 — white logo on dark sidebar                    */
/* ========================================================================== */
/* Uses a white transparent Delidips logo directly on the dark sidebar.      */

body.dashboard-theme [data-dashboard-brand][data-dashboard-logo-surface="transparent"] .dashboard-brand-logo-frame {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

body.dashboard-theme [data-dashboard-brand] .dashboard-brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

@media (min-width: 1400px) and (min-height: 760px) {
  body.dashboard-theme {
    --adaptive-sidebar-expanded-width: 224px;
  }

  body.dashboard-theme .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-header,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-header {
    min-height: 58px !important;
    padding: 7px 10px 4px !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    gap: 12px !important;
    min-height: 46px !important;
    height: 46px !important;
    padding: 1px 2px !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {
    display: grid !important;
    width: 54px !important;
    height: 40px !important;
    flex: 0 0 54px !important;
    padding: 0 !important;
    place-items: center !important;
    overflow: visible !important;
    border-radius: 0 !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo {
    width: auto !important;
    height: auto !important;
    max-width: 54px !important;
    max-height: 40px !important;
  }

  body.dashboard-theme .dashboard-brand-name,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-name,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-name {
    max-width: 142px !important;
    font-size: .99rem !important;
    font-weight: 850 !important;
    line-height: 1.05 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }
}

@media (min-width: 768px) and (max-width: 1399px),
       (min-width: 1400px) and (max-height: 759px) {
  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {
    width: 46px !important;
    height: 34px !important;
    flex: 0 0 46px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo {
    width: auto !important;
    height: auto !important;
    max-width: 46px !important;
    max-height: 34px !important;
  }
}

@media (max-width: 767px) {
  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame,
  body.dashboard-theme .dashboard-mobile-brand-mark.dashboard-brand-logo-frame {
    width: 42px !important;
    height: 32px !important;
    flex: 0 0 42px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo,
  body.dashboard-theme .dashboard-mobile-brand-mark .dashboard-brand-logo {
    width: auto !important;
    height: auto !important;
    max-width: 42px !important;
    max-height: 32px !important;
  }
}


/* ========================================================================== */
/* Dashboard navigation v5.5 — brand separator to avoid duplicated feel       */
/* ========================================================================== */
/* The Delidips logo already contains a wordmark. Add a subtle separator and  */
/* soften the name at the right so it reads as a label, not a duplicate logo. */

@media (min-width: 1400px) and (min-height: 760px) {
  body.dashboard-theme .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-expanded .dashboard-sidebar-brand,
  body.dashboard-theme.sidebar-collapsed .dashboard-sidebar-brand {
    gap: 10px !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame {
    position: relative !important;
    margin-right: 10px !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -10px;
    width: 1px;
    height: 26px;
    border-radius: 999px;
    background: rgba(250, 247, 239, .22);
    transform: translateY(-50%);
  }

  body.dashboard-theme .dashboard-brand-name,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-name,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-name {
    color: rgba(250,247,239,.92) !important;
    font-size: .92rem !important;
    font-weight: 780 !important;
    letter-spacing: 0 !important;
  }
}

@media (max-width: 767px) {
  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame,
  body.dashboard-theme .dashboard-mobile-brand-mark.dashboard-brand-logo-frame {
    position: relative !important;
    margin-right: 8px !important;
  }

  body.dashboard-theme .dashboard-sidebar-brand .dashboard-brand-logo-frame::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -8px;
    width: 1px;
    height: 22px;
    border-radius: 999px;
    background: rgba(250, 247, 239, .18);
    transform: translateY(-50%);
  }

  body.dashboard-theme .dashboard-brand-name,
  body.dashboard-theme.sidebar-expanded .dashboard-brand-name,
  body.dashboard-theme.sidebar-collapsed .dashboard-brand-name {
    font-size: .88rem !important;
    font-weight: 760 !important;
    letter-spacing: 0 !important;
  }
}


/* ========================================================================== */
/* Configuration · moderate password policy                                   */
/* ========================================================================== */

.dashboard-theme .configuration-password-field {
  align-content: start;
}

.dashboard-theme .configuration-password-policy {
  display: block;
  margin-top: -1px;
  color: #747c80;
  font-size: .62rem;
  font-weight: 650;
  line-height: 1.35;
}

.dashboard-theme .configuration-password-policy.is-invalid {
  color: #a33f2c;
}


/* ========================================================================== */
/* Configuration · compact users workspace                                    */
/* ========================================================================== */

@media (min-width: 901px) {
  .dashboard-theme #config-panel-users .configuration-abm-toolbar {
    align-items: center;
    padding: 9px 13px;
  }

  .dashboard-theme #config-panel-users .configuration-user-selector {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: min(430px, 58%);
  }

  .dashboard-theme #config-panel-users .configuration-user-selector > span {
    flex: 0 0 auto;
    margin: 0;
  }

  .dashboard-theme #config-panel-users .configuration-user-selector select {
    min-height: 36px;
    padding-block: 6px;
  }

  .dashboard-theme #config-panel-users .configuration-new-user-button {
    min-height: 38px;
    padding: 8px 17px;
  }

  .dashboard-theme #config-panel-users .configuration-abm-editor {
    padding: 11px 13px 10px;
  }

  .dashboard-theme #config-panel-users .configuration-abm-heading {
    align-items: center;
    margin-bottom: 8px;
  }

  .dashboard-theme #config-panel-users .configuration-abm-heading > div:first-child {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 9px;
    min-width: 0;
  }

  .dashboard-theme #config-panel-users .configuration-abm-heading .eyebrow {
    flex: 0 0 100%;
    line-height: 1;
  }

  .dashboard-theme #config-panel-users .configuration-abm-heading h3 {
    margin: 0;
    font-size: .98rem;
    line-height: 1.2;
  }

  .dashboard-theme #config-panel-users .configuration-abm-heading p {
    margin: 0;
    font-size: .69rem;
    line-height: 1.25;
  }

  .dashboard-theme #config-panel-users .configuration-single-user-form {
    gap: 9px;
  }

  .dashboard-theme #config-panel-users .configuration-user-fields {
    gap: 9px;
    max-width: none;
  }

  .dashboard-theme #config-panel-users .settings-form-grid label {
    gap: 4px;
  }

  .dashboard-theme #config-panel-users .settings-form-grid label > span {
    font-size: .68rem;
  }

  .dashboard-theme #config-panel-users .settings-form-grid input {
    min-height: 37px;
    padding: 7px 10px;
    border-radius: 10px;
  }

  .dashboard-theme #config-panel-users .configuration-password-policy {
    margin: 0;
    min-height: 0;
    font-size: .57rem;
    line-height: 1.15;
    white-space: nowrap;
  }

  .dashboard-theme #config-panel-users .configuration-permissions-header {
    align-items: center;
    gap: 10px;
    padding-top: 0;
  }

  .dashboard-theme #config-panel-users .configuration-permissions-header > div:first-child {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 3px 7px;
  }

  .dashboard-theme #config-panel-users .configuration-permissions-header strong {
    font-size: .8rem;
  }

  .dashboard-theme #config-panel-users .configuration-permissions-header span {
    font-size: .63rem;
  }

  .dashboard-theme #config-panel-users .configuration-permission-actions .ghost-button {
    min-height: 27px;
    padding: 4px 8px;
    font-size: .59rem;
  }

  .dashboard-theme #config-panel-users .configuration-permissions-groups {
    grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr);
    gap: 9px;
  }

  .dashboard-theme #config-panel-users .configuration-permission-group {
    padding: 8px;
    border-radius: 13px;
  }

  .dashboard-theme #config-panel-users .configuration-permission-group-heading {
    margin-bottom: 6px;
  }

  .dashboard-theme #config-panel-users .configuration-permission-group-heading > span {
    font-size: .66rem;
  }

  .dashboard-theme #config-panel-users .configuration-permission-group-heading small {
    font-size: .55rem;
  }

  .dashboard-theme #config-panel-users .configuration-permission-grid-compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .dashboard-theme #config-panel-users .configuration-permission-grid-compact.is-monitor-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme #config-panel-users .configuration-permission-grid-compact .settings-permission-chip {
    min-height: 32px;
    gap: 6px;
    padding: 5px 7px;
    border-radius: 9px;
    font-size: .63rem;
  }

  .dashboard-theme #config-panel-users .configuration-permission-grid-compact .settings-permission-chip .ui-icon {
    width: 14px;
    height: 14px;
    font-size: .76rem;
  }

  .dashboard-theme #config-panel-users .configuration-abm-actions {
    margin-top: 9px;
    padding-top: 9px;
  }

  .dashboard-theme #config-panel-users .configuration-security-note {
    font-size: .59rem;
  }

  .dashboard-theme #config-panel-users .configuration-form-actions > .slim-button,
  .dashboard-theme #config-panel-users .configuration-delete-inline .delete-user-button {
    min-height: 37px;
    padding: 8px 16px;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .dashboard-theme #config-panel-users .configuration-permission-grid-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-theme #config-panel-users .configuration-password-policy {
    white-space: normal;
  }
}

/* ========================================================================== */
/* Configuration · user field alignment + flexible report recurrence          */
/* ========================================================================== */

@media (min-width: 901px) {
  .dashboard-theme #config-panel-users .configuration-user-fields > label {
    align-content: start;
    align-self: start;
  }
}

.dashboard-theme .configuration-report-schedule-grid {
  grid-template-columns: minmax(165px, .9fr) minmax(190px, .95fr) minmax(235px, 1.15fr) minmax(205px, 1.02fr) minmax(135px, .7fr) minmax(100px, .5fr);
}

.dashboard-theme .configuration-report-recurrence-field,
.dashboard-theme .configuration-report-period-field {
  align-content: start;
}

.dashboard-theme .configuration-report-recurrence-control {
  display: grid;
  grid-template-columns: auto minmax(58px, .34fr) minmax(112px, 1fr);
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.dashboard-theme .configuration-report-recurrence-prefix {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  color: #687176;
  font-size: .64rem;
  font-weight: 760;
  white-space: nowrap;
}

.dashboard-theme .configuration-report-recurrence-control input,
.dashboard-theme .configuration-report-recurrence-control select {
  min-width: 0;
}

.dashboard-theme .configuration-report-recurrence-control input {
  text-align: center;
}

.dashboard-theme .configuration-report-recurrence-field > small {
  min-height: 0;
  margin-top: -1px;
  color: #737c80;
  font-size: .50rem;
  line-height: 1.2;
}

.dashboard-theme .configuration-report-period-control {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(58px, .38fr);
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.dashboard-theme .configuration-report-period-control select,
.dashboard-theme .configuration-report-period-control input {
  min-width: 0;
}

.dashboard-theme .configuration-report-period-control input {
  text-align: center;
}

.dashboard-theme .configuration-report-period-control input[hidden] {
  display: none !important;
}

.dashboard-theme .configuration-report-period-field > small {
  min-height: 0;
  margin-top: -1px;
  color: #737c80;
  font-size: .50rem;
  line-height: 1.2;
}

.dashboard-theme .configuration-report-period-label {
  color: #6f787c;
}

@media (max-width: 1300px) and (min-width: 901px) {
  .dashboard-theme .configuration-report-schedule-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-theme .configuration-report-schedule-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-theme .configuration-report-recurrence-control {
    grid-template-columns: auto minmax(64px, .3fr) minmax(120px, 1fr);
  }

  .dashboard-theme .configuration-report-period-control {
    grid-template-columns: minmax(150px, 1fr) minmax(68px, .35fr);
  }
}

/* ========================================================================== */
/* Reportes - Etapa 1: salud operativa e historial de ejecuciones             */
/* ========================================================================== */
.dashboard-theme .configuration-report-health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 0 0 10px;
}

.dashboard-theme .configuration-report-health-grid.is-issues-only {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.dashboard-theme .configuration-report-health-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(17, 24, 28, .09);
  border-radius: 13px;
  background: rgba(255, 255, 255, .58);
  box-shadow: inset 3px 0 0 rgba(112, 120, 124, .25);
}

.dashboard-theme .configuration-report-health-card.is-ok {
  border-color: rgba(35, 122, 82, .16);
  background: rgba(239, 249, 244, .66);
  box-shadow: inset 3px 0 0 rgba(35, 122, 82, .72);
}

.dashboard-theme .configuration-report-health-card.is-warning {
  border-color: rgba(216, 132, 16, .2);
  background: rgba(255, 248, 235, .72);
  box-shadow: inset 3px 0 0 rgba(216, 132, 16, .72);
}

.dashboard-theme .configuration-report-health-card.is-error {
  border-color: rgba(174, 63, 49, .2);
  background: rgba(255, 241, 238, .72);
  box-shadow: inset 3px 0 0 rgba(174, 63, 49, .72);
}

.dashboard-theme .configuration-report-health-heading,
.dashboard-theme .configuration-report-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.dashboard-theme .configuration-report-health-heading strong,
.dashboard-theme .configuration-report-history-heading h3 {
  margin: 0;
  color: #1f292c;
  font-size: .68rem;
  font-weight: 900;
}

.dashboard-theme .configuration-report-health-state,
.dashboard-theme .configuration-report-run-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(112, 120, 124, .09);
  color: #667074;
  font-size: .5rem;
  font-weight: 900;
  white-space: nowrap;
}

.dashboard-theme .configuration-report-health-card.is-ok .configuration-report-health-state,
.dashboard-theme .configuration-report-run-status.is-ok {
  background: rgba(35, 122, 82, .12);
  color: #236a4d;
}

.dashboard-theme .configuration-report-health-card.is-warning .configuration-report-health-state,
.dashboard-theme .configuration-report-run-status.is-warning {
  background: rgba(216, 132, 16, .12);
  color: #8b590f;
}

.dashboard-theme .configuration-report-health-card.is-error .configuration-report-health-state,
.dashboard-theme .configuration-report-run-status.is-error {
  background: rgba(174, 63, 49, .11);
  color: #934337;
}

.dashboard-theme .configuration-report-run-status.is-progress {
  background: rgba(49, 93, 133, .1);
  color: #365f82;
}

.dashboard-theme .configuration-report-health-card p,
.dashboard-theme .configuration-report-health-card small,
.dashboard-theme .configuration-report-history-heading p {
  margin: 0;
  color: #737d80;
  font-size: .55rem;
  line-height: 1.32;
}

.dashboard-theme .configuration-report-health-card p {
  color: #4d585b;
  font-size: .58rem;
}

.dashboard-theme .configuration-report-history-card {
  padding: 12px 14px;
  border: 1px solid var(--report-border);
  border-radius: 17px;
  background: rgba(251, 248, 241, .94);
}

.dashboard-theme .configuration-report-history-heading {
  align-items: flex-start;
  margin-bottom: 9px;
}

.dashboard-theme .configuration-report-history-heading > div {
  display: grid;
  gap: 2px;
}

.dashboard-theme .configuration-report-history-empty {
  padding: 11px;
  border: 1px dashed rgba(17, 24, 28, .12);
  border-radius: 11px;
  color: #747d80;
  font-size: .6rem;
  text-align: center;
}

.dashboard-theme .configuration-report-history-table-wrap {
  overflow: auto;
  border: 1px solid rgba(17, 24, 28, .07);
  border-radius: 12px;
  background: rgba(255, 255, 255, .55);
}

.dashboard-theme .configuration-report-history-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  font-size: .59rem;
}

.dashboard-theme .configuration-report-history-table th {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(17, 24, 28, .08);
  background: rgba(17, 24, 28, .035);
  color: #6c7579;
  font-size: .49rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
}

.dashboard-theme .configuration-report-history-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(17, 24, 28, .055);
  color: #364044;
  vertical-align: middle;
}

.dashboard-theme .configuration-report-history-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-theme .configuration-report-history-table td > strong,
.dashboard-theme .configuration-report-history-table td > small {
  display: block;
}

.dashboard-theme .configuration-report-history-table td > small {
  margin-top: 2px;
  color: #879094;
  font-size: .49rem;
}

.dashboard-theme .configuration-report-run-details {
  position: relative;
}

.dashboard-theme .configuration-report-run-details > summary {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid rgba(17, 24, 28, .1);
  border-radius: 7px;
  background: #fff;
  color: #465054;
  cursor: pointer;
  font-size: .52rem;
  font-weight: 850;
  list-style: none;
}

.dashboard-theme .configuration-report-run-details > summary::-webkit-details-marker {
  display: none;
}

.dashboard-theme .configuration-report-run-detail-panel {
  display: grid;
  gap: 8px;
  min-width: 330px;
  max-width: 480px;
  margin-top: 6px;
  padding: 9px;
  border: 1px solid rgba(17, 24, 28, .1);
  border-radius: 10px;
  background: #fffdf8;
  box-shadow: 0 10px 28px rgba(17, 24, 28, .09);
}

.dashboard-theme .configuration-report-run-detail-panel dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  margin: 0;
}

.dashboard-theme .configuration-report-run-detail-panel dl > div {
  min-width: 0;
}

.dashboard-theme .configuration-report-run-detail-panel dt {
  color: #8a9295;
  font-size: .47rem;
  font-weight: 850;
  text-transform: uppercase;
}

.dashboard-theme .configuration-report-run-detail-panel dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: #343f42;
  font-size: .55rem;
}

.dashboard-theme .configuration-report-run-detail-panel code {
  display: inline-block;
  margin-left: 4px;
  color: #7b5b2d;
  font-size: .48rem;
}

.dashboard-theme .configuration-report-run-error {
  display: grid;
  gap: 3px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(174, 63, 49, .07);
  color: #7f4139;
  font-size: .54rem;
  line-height: 1.35;
}

.dashboard-theme .configuration-report-run-error span {
  overflow-wrap: anywhere;
}

@media (max-width: 1050px) {
  .dashboard-theme .configuration-report-health-grid {
    grid-template-columns: 1fr;
  }
}

/* Historial por programación: evita una tabla global permanente y concentra el detalle en un modal. */
.dashboard-theme .configuration-report-action-button.is-history {
  border-color: rgba(49, 93, 133, .16);
  color: #365f82;
}

.dashboard-theme .configuration-report-action-button.is-history:hover {
  border-color: rgba(49, 93, 133, .28);
  background: rgba(49, 93, 133, .055);
}

.dashboard-theme .configuration-report-history-count {
  display: inline-flex;
  min-width: 17px;
  height: 17px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(49, 93, 133, .1);
  color: #365f82;
  font-size: .46rem;
  font-weight: 900;
  line-height: 1;
}

.dashboard-theme .configuration-report-history-dialog {
  width: min(980px, calc(100vw - 36px));
  max-width: none;
  max-height: min(82vh, 760px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 28, .12);
  border-radius: 18px;
  background: #fbf8f1;
  color: #263034;
  box-shadow: 0 26px 70px rgba(17, 24, 28, .26);
}

.dashboard-theme .configuration-report-history-dialog::backdrop {
  background: rgba(12, 18, 20, .48);
  backdrop-filter: blur(2px);
}

.dashboard-theme .configuration-report-history-dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  max-height: min(82vh, 760px);
  padding: 16px;
}

.dashboard-theme .configuration-report-history-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-theme .configuration-report-history-dialog-header > div:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.dashboard-theme .configuration-report-history-dialog-header .configuration-kicker {
  color: #d88410;
  font-size: .5rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.dashboard-theme .configuration-report-history-dialog-header h3 {
  margin: 0;
  overflow-wrap: anywhere;
  color: #1f292c;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.15;
}

.dashboard-theme .configuration-report-history-dialog-header p {
  margin: 0;
  color: #737d80;
  font-size: .58rem;
  line-height: 1.35;
}

.dashboard-theme .configuration-report-history-dialog-tools {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.dashboard-theme .configuration-report-history-close {
  display: inline-flex;
  width: 31px;
  height: 31px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(17, 24, 28, .1);
  border-radius: 9px;
  background: #fff;
  color: #4a5559;
  cursor: pointer;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
}

.dashboard-theme .configuration-report-history-close:hover {
  border-color: rgba(216, 132, 16, .28);
  background: rgba(216, 132, 16, .06);
  color: #9a5d0b;
}

.dashboard-theme .configuration-report-history-dialog .configuration-report-history-table-wrap {
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.dashboard-theme .configuration-report-history-table.is-schedule-history {
  min-width: 720px;
}

.dashboard-theme .configuration-report-history-dialog .configuration-report-run-detail-panel {
  min-width: 300px;
  max-width: 430px;
}

@media (max-width: 760px) {
  .dashboard-theme .configuration-report-history-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
    border-radius: 14px;
  }

  .dashboard-theme .configuration-report-history-dialog-shell {
    max-height: calc(100vh - 18px);
    padding: 12px;
  }

  .dashboard-theme .configuration-report-history-dialog-header {
    gap: 10px;
  }
}

.dashboard-theme .configuration-report-period-note {
  margin: 5px 0 0;
  color: #6f787c;
  font-size: .52rem;
  line-height: 1.3;
}


/* ========================================================================== */
/* Configuration · report editor compact layout                               */
/* ========================================================================== */
.dashboard-theme #config-panel-reports .configuration-reports-heading {
  margin-bottom: 6px;
}

.dashboard-theme #config-panel-reports .configuration-reports-heading h2 {
  margin-bottom: 0;
  line-height: 1.05;
}

.dashboard-theme .configuration-report-workspace.is-report-editor-open .configuration-report-list-card {
  padding: 9px 12px 10px;
}

.dashboard-theme .configuration-report-editor {
  margin-bottom: 0;
  padding: 9px 10px 10px;
}

.dashboard-theme .configuration-report-editor-heading-compact {
  align-items: center;
  margin-bottom: 6px;
}

.dashboard-theme .configuration-report-editor-heading-compact h3 {
  margin: 0;
  font-size: .82rem;
  line-height: 1.15;
}

.dashboard-theme .configuration-report-schedule-grid {
  gap: 6px;
}

.dashboard-theme .configuration-report-form-grid > label {
  gap: 3px;
}

.dashboard-theme .configuration-report-form-grid select,
.dashboard-theme .configuration-report-form-grid input,
.dashboard-theme .configuration-report-user-static,
.dashboard-theme .configuration-report-recurrence-prefix {
  min-height: 34px;
}

.dashboard-theme .configuration-report-form-grid select,
.dashboard-theme .configuration-report-form-grid input {
  padding-block: 5px;
}

.dashboard-theme .configuration-report-recurrence-field > small,
.dashboard-theme .configuration-report-period-field > small {
  display: none;
}

.dashboard-theme .configuration-report-module-selector {
  margin-top: 7px;
  padding: 8px;
  border-radius: 11px;
}

.dashboard-theme .configuration-report-modules-header {
  align-items: center;
  margin-bottom: 6px;
}

.dashboard-theme .configuration-report-modules-header strong {
  font-size: .7rem;
}

.dashboard-theme .configuration-report-modules-header .configuration-permission-actions {
  gap: 5px;
}

.dashboard-theme .configuration-report-modules-header .ghost-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: .53rem;
}

.dashboard-theme .configuration-report-module-grid {
  gap: 5px;
}

.dashboard-theme .configuration-report-module-chip {
  min-height: 39px;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 9px;
}

.dashboard-theme .configuration-report-module-chip > input,
.dashboard-theme .configuration-report-module-chip > .ui-icon {
  margin-top: 0;
}

.dashboard-theme .configuration-report-module-copy {
  display: block;
}

.dashboard-theme .configuration-report-module-copy strong {
  display: block;
  overflow: hidden;
  font-size: .6rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-theme .configuration-report-module-copy small {
  display: none;
}

.dashboard-theme .configuration-report-form-footer {
  justify-content: flex-end;
  margin-top: 6px;
}

.dashboard-theme .configuration-report-permission-note:not(.is-error) {
  display: none;
}

.dashboard-theme .configuration-report-form-actions .ghost-button,
.dashboard-theme .configuration-report-form-actions .primary-button {
  min-height: 32px;
}

@media (min-width: 1500px) {
  .dashboard-theme .configuration-report-module-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-theme .configuration-report-module-chip {
    min-height: 44px;
  }

  .dashboard-theme .configuration-report-module-copy strong {
    white-space: normal;
  }
}
