/* Dashboard reference override */
body[data-active-view="dashboard"] .top-search,
body[data-active-view="dashboard"] .notification-button,
body[data-active-view="dashboard"] .admin-avatar,
body[data-active-view="dashboard"] .admin-menu,
body[data-active-view="dashboard"] .top-brand {
  display: none;
}

body[data-active-view="dashboard"] .topbar {
  height: 112px;
  min-height: 112px;
  padding: 0 26px;
  grid-template-columns: minmax(360px, 1fr) auto;
  gap: 20px;
}

body[data-active-view="dashboard"] .topbar-left {
  gap: 16px;
}

body[data-active-view="dashboard"] .top-brand,
body[data-active-view="dashboard"] .top-brand-logo {
  width: 128px;
  height: 36px;
}

body[data-active-view="dashboard"] .topbar h1 {
  font-size: 20px;
  font-weight: 900;
}

body[data-active-view="dashboard"] .top-actions {
  grid-column: auto;
  gap: 16px;
}

body[data-active-view="dashboard"] #backupBtn,
body[data-active-view="dashboard"] #restoreBtn {
  width: 122px;
  height: 50px;
  min-height: 50px;
}

body[data-active-view="dashboard"] .origin-warning {
  height: 70px;
  min-height: 70px;
  margin: 0 22px 22px;
  padding: 15px 56px 12px 66px;
  font-size: 13px;
  line-height: 1.35;
}

body[data-active-view="dashboard"] .dashboard-grid {
  gap: 16px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(-n + 3) {
  height: 228px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(n + 4):nth-child(-n + 6) {
  height: 182px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(n + 7) {
  height: 260px;
}

body[data-active-view="dashboard"] .dashboard-card,
body[data-active-view="dashboard"] .dashboard-card.compact {
  padding: 22px 24px;
  overflow: hidden;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(1) .dashboard-card-head,
body[data-active-view="dashboard"] .dashboard-card:nth-child(2) .dashboard-card-head,
body[data-active-view="dashboard"] .dashboard-card:nth-child(3) .dashboard-card-head {
  min-height: 86px;
}

body[data-active-view="dashboard"] .erp-card-icon {
  width: 64px;
  height: 64px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(n + 4):nth-child(-n + 6) .erp-card-icon {
  width: 56px;
  height: 56px;
}

body[data-active-view="dashboard"] .dashboard-card-head h2 {
  font-size: 16px;
}

body[data-active-view="dashboard"] .dashboard-card-head span {
  font-size: 13px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(1) .erp-icon-head strong {
  margin-top: 16px;
  font-size: 32px;
}

body[data-active-view="dashboard"] .dashboard-kpi-row strong,
body[data-active-view="dashboard"] .dashboard-split-kpi strong {
  font-size: 28px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(6) .dashboard-kpi-row strong {
  font-size: 26px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut-row {
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 24px;
  height: 96px;
  min-height: 0;
  flex: 0 0 96px;
  margin-top: 12px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut {
  width: 96px;
  background: conic-gradient(#1767d8 0 25%, #f59e0b 25% 31%, #22c55e 31% 100%);
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut::after {
  inset: 27px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut span {
  font-size: 19px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-legend {
  gap: 8px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-legend div {
  font-size: 13px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-legend i {
  width: 11px;
  height: 11px;
}

body[data-active-view="dashboard"] .horizontal-bars {
  margin-top: 30px;
  gap: 11px;
}

body[data-active-view="dashboard"] .dashboard-list-item {
  min-height: 40px;
}

/* Dashboard pixel alignment: keep the reference layout stable after refresh. */
body[data-active-view="dashboard"] {
  --dashboard-topbar-height: 112px;
}

body[data-active-view="dashboard"] .top-search,
body[data-active-view="dashboard"] .notification-button,
body[data-active-view="dashboard"] .admin-avatar,
body[data-active-view="dashboard"] .admin-menu {
  display: none;
}

body[data-active-view="dashboard"] .topbar {
  height: var(--dashboard-topbar-height);
  min-height: var(--dashboard-topbar-height);
  padding: 0 26px;
  grid-template-columns: minmax(420px, 1fr) auto;
  gap: 20px;
}

body[data-active-view="dashboard"] .topbar-left {
  gap: 24px;
}

body[data-active-view="dashboard"] .top-brand,
body[data-active-view="dashboard"] .top-brand-logo {
  width: 128px;
  height: 36px;
}

body[data-active-view="dashboard"] .topbar h1 {
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
}

body[data-active-view="dashboard"] .top-actions {
  grid-column: auto;
  gap: 16px;
}

body[data-active-view="dashboard"] #backupBtn,
body[data-active-view="dashboard"] #restoreBtn {
  width: 122px;
  height: 50px;
  min-height: 50px;
  border-radius: 8px;
}

body[data-active-view="dashboard"] .main {
  background: #f4f7fc;
}

body[data-active-view="dashboard"] .view.active {
  padding: 22px 22px 0;
}

body[data-active-view="dashboard"] .origin-warning {
  height: 70px;
  min-height: 70px;
  margin: 0 0 22px;
  padding: 15px 56px 12px 66px;
  font-size: 13px;
  line-height: 1.35;
}

body[data-active-view="dashboard"] .dashboard-grid {
  gap: 16px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(-n + 3) {
  height: 228px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(n + 4):nth-child(-n + 6) {
  height: 182px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(n + 7) {
  height: 260px;
}

body[data-active-view="dashboard"] .dashboard-card,
body[data-active-view="dashboard"] .dashboard-card.compact {
  padding: 22px 24px;
  overflow: hidden;
  border-radius: 16px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) {
  padding: 18px 22px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-card-head {
  min-height: 52px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .erp-card-icon {
  width: 50px;
  height: 50px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  height: 84px;
  min-height: 0;
  flex: 0 0 84px;
  margin-top: 6px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut {
  width: 84px;
  background: conic-gradient(#1767d8 0 25%, #f59e0b 25% 31%, #22c55e 31% 100%);
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut::after {
  inset: 23px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut span {
  font-size: 17px;
  line-height: 1;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-legend {
  gap: 6px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-legend div {
  font-size: 12px;
  line-height: 1.18;
  white-space: nowrap;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-legend i {
  width: 10px;
  height: 10px;
}

/* Final requested tuning */
.brand {
  justify-items: center;
  padding: 0 8px;
}

.brand-logo {
  width: 116px;
  height: 92px;
  object-fit: contain;
  object-position: center;
  transform: none;
}

.brand span {
  padding-left: 0;
  text-align: center;
}

#backupBtn,
#restoreBtn {
  justify-content: center;
  align-items: center;
  text-align: center;
}

body[data-active-view="dashboard"] #backupBtn,
body[data-active-view="dashboard"] #restoreBtn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

body[data-active-view="dashboard"] .origin-warning {
  margin-bottom: 11px;
}

body[data-active-view="dashboard"] .dashboard-donut {
  position: relative;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut span {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: max-content;
  text-align: center;
}

body[data-active-view="dashboard"] .main > .notice.origin-warning,
body[data-active-view="dashboard"] .origin-warning {
  margin-bottom: 9px;
}

body[data-active-view="dashboard"] .view.active {
  padding-top: 0;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut::after {
  inset: 17px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(5) .dashboard-donut span {
  font-size: 12px;
  line-height: 1;
}

body[data-active-view="dashboard"] .top-brand {
  display: none;
}

body[data-active-view="dashboard"] .topbar-left {
  gap: 16px;
}

body[data-active-view="dashboard"] .topbar {
  border-bottom: 1px solid #e3e8f3;
}

/* Dashboard inventory bars: keep the first card compact without clipping. */
body[data-active-view="dashboard"] .dashboard-card:nth-child(1) .dashboard-bars {
  min-height: 44px;
  margin-top: auto;
  gap: 18px;
  align-items: end;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(1) .dashboard-vbar {
  align-items: center;
  justify-items: stretch;
  gap: 5px;
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(1) .dashboard-vbar i {
  justify-self: center;
  height: 5px;
  min-height: 5px;
  max-width: 100%;
  border-radius: 999px;
}

/* Dashboard header icons: keep the tile size, but make the glyph itself legible. */
body[data-active-view="dashboard"] .erp-card-icon {
  font-size: 0;
  line-height: 0;
}

body[data-active-view="dashboard"] .erp-card-icon::before {
  width: min(54px, calc(100% - 8px));
  height: min(54px, calc(100% - 8px));
}

body[data-active-view="dashboard"] .dashboard-card:nth-child(n + 4):nth-child(-n + 6) .erp-card-icon::before {
  width: min(46px, calc(100% - 8px));
  height: min(46px, calc(100% - 8px));
}

body[data-active-view="dashboard"] .erp-card-icon.red::before {
  content: "";
}

/* Dashboard monthly count analysis */
body[data-active-view="dashboard"] .dashboard-count-analysis-card {
  display: grid;
  grid-template-rows: auto minmax(74px, 1fr) auto;
  gap: 10px;
}

body[data-active-view="dashboard"] .dashboard-count-analysis-card .dashboard-analysis-head {
  align-items: flex-start;
  min-height: 0;
}

body[data-active-view="dashboard"] .dashboard-year-pill {
  padding: 4px 9px;
  border: 1px solid #d7e3f5;
  border-radius: 999px;
  background: #f8fbff;
  color: #5a6e91;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

body[data-active-view="dashboard"] .dashboard-month-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 84px;
  padding-top: 4px;
  border-bottom: 1px solid #edf2f8;
}

body[data-active-view="dashboard"] .dashboard-month-bar {
  display: grid;
  grid-template-rows: 16px 1fr 16px;
  align-items: end;
  justify-items: center;
  height: 84px;
  min-width: 0;
  color: #071638;
}

body[data-active-view="dashboard"] .dashboard-month-bar strong {
  align-self: start;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

body[data-active-view="dashboard"] .dashboard-month-bar i {
  display: block;
  width: 18px;
  max-height: 48px;
  min-height: 3px;
  border-radius: 7px 7px 2px 2px;
  background: #6b8df7;
  box-shadow: 0 8px 16px rgba(75, 105, 220, 0.22);
}

body[data-active-view="dashboard"] .dashboard-month-bar.empty i {
  width: 5px;
  border-radius: 999px;
  background: #dce5f3;
  box-shadow: none;
}

body[data-active-view="dashboard"] .dashboard-month-bar span {
  align-self: end;
  color: #7988a2;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

body[data-active-view="dashboard"] .dashboard-month-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 2px;
}

body[data-active-view="dashboard"] .dashboard-month-summary article {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

body[data-active-view="dashboard"] .dashboard-month-summary .erp-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

body[data-active-view="dashboard"] .dashboard-month-summary .erp-card-icon::before {
  width: 30px;
  height: 30px;
}

body[data-active-view="dashboard"] .dashboard-month-summary span:not(.erp-card-icon) {
  display: block;
  color: #6c7d9d;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
}

body[data-active-view="dashboard"] .dashboard-month-summary strong {
  display: block;
  margin-top: 2px;
  color: #071638;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
}
