.sheet {
  position: relative;
  max-width: 100%;
  min-height: 100vh;
  color: #888;
  font-size: .8rem;
}

.btn {
  position: relative;
  min-width: 24px;
  height: 24px;
  padding: 3px;
  display: inline-block;
  background: transparent;
  border: none;
  outline: none;
  text-align: center;
  color: rgba(0, 0, 0, 0.7);
  user-select: none;
}
.btn > i {
  font-size: 18px;
}
.btn:hover {
  background: #eee;
  cursor: pointer;
}

/*--- sheet header ---*/
.sheet__header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-height);
  padding: 6px 4px 0;
  display: flex;
  justify-content: space-between;
  background-color: #fff;
  z-index: 100;
}
.sheet__header-input {
  padding: 2px 7px;
  color: #333;
  border: 2px solid transparent;
  border-radius: 2px;
  height: 26px;
  font-size: 18px;
  line-height: 22px;
  outline: none;
}
.sheet__header-input:hover {
  border: 2px solid var(--border-color);
}
.sheet__header-input:focus {
  border: 2px solid var(--primary-color);
}
.sheet__header-btns {
  flex-shrink: 0;
  margin-right: 5px;
}
.sheet__header-btn {
  height: 28px;
}
.sheet__header-btn:active,
.sheet__header-btn.active {
  color: red;
}
.btn > i.sheet__header-icon {
  font-size: 22px;
}

/*--- sheet toolbar ---*/
.sheet__toolbar {
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  display: flex;
  gap: 1px;
  padding: 7px 10px;
  height: var(--toolbar-height);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  background-color: #fff;
  z-index: 100;
}
.toolbar__btn--selected {
  background-color: #eee;
  color: var(--accent-green);
}
.toolbar__btn:active {
  color: var(--accent-green);
}
.toolbar__label {
  padding: 4px;
  cursor: pointer;
}
.toobar_label:first-child {
  margin-right: 3px;
}
.toolbar__label:hover {
  background-color: #eee;
}
.toolbar__input {
  display: none;
}
.toolbar__input-icon {
  font-size: 16px;
}

/*--- sheet formula ---*/
.sheet__formula {
  position: absolute;
  top: calc(var(--header-height) + var(--toolbar-height));
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  height: var(--formula-height);
  border-bottom: 1px solid var(--border-color);
  background-color: #fff;
  z-index: 100;
}
.formula__info {
  font-size: 18px;
  font-style: italic;
  text-align: center;
  border-right: 1px solid var(--border-color);
  min-width: var(--info-cell-width);
}

.formula__input {
  flex-grow: 1;
  padding: 4px;
  font-size: 12px;
  outline: none;
  color: #000;
}

/*--- sheet table ---*/
.sheet__table {
  position: absolute;
  top: calc( var(--header-height) + var(--toolbar-height) + var(--formula-height) );
  left: 0;
  right: 0;
  height: calc( 75vh - var(--header-height) + var(--toolbar-height) + var(--formula-height) );
  overflow-x: auto;
  padding-bottom: 20px;
  /* touch-action: none; */
}

.row {
  position: relative;
  display: flex;
  min-height: 20px;
  height: var(--row-height);
}
.row--fixed {
  position: sticky;
  top: 0;
  margin-bottom: 2px;
  background-color: #f8f9fa;
  z-index: 100;
}
.row-info {
  position: sticky;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: var(--info-cell-width);
  height: 100%;
  margin-right: 2px;
  border: 1px solid var(--border-color);
  background: #f8f9fa;
  border-top: none;
  user-select: none;
  z-index: 10;
}
/*Псевдоэлемент для закрытия щели сверху у .row-info с номером 1*/
.row--fixed + .row > .row-info::after {
  content: '';
  position: absolute;
  left: 0;
  top: -2px;
  width: 100%;
  height: 2px;
  background: #f8f9fa;
}
.row-data {
  display: flex;
}

.column {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f8f9fa;
  min-width: 40px;
  width: var(--cell-width);
  height: 100%;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}
.col-resize,
.row-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  background: var(--primary-color);
  opacity: 0;
  z-index: 1000;
  touch-action: none;
}
.col-resize {
  top: 0;
  width: 4px;
  cursor: col-resize;
}
.row-resize {
  left: 0;
  height: 4px;
  cursor: row-resize;
}
.col-resize:hover,
.row-resize:hover {
  opacity: 1!important;
}

.cell {
  padding: 5px;
  min-width: 40px;
  width: var(--cell-width);
  height: 100%;
  display: flex;
  border-right: 1px solid #e2e3e3;
  border-bottom: 1px solid #e2e3e3;
  outline: none;
  color: #111;
  word-break: break-all;
  overflow: hidden;
  pointer-events: auto;
}
.cell.selected {
  overflow: visible;
}

.selected {
  border: none;
  outline: 1px solid var(--primary-color);
  z-index: 2;
}
.selected--main {
  position: relative;
  outline-width: 2px;
  z-index: 10;
}
.selector {
  position: relative;
}
.selector::after {
  content: '';
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background-color: var(--primary-color);
  border-radius: 50%;
  cursor: crosshair;
}
.selector-selection {
  position: fixed;
  border: 2px dashed var(--primary-color);
  pointer-events: none;
  z-index: 10;
}
.touch-action-none {
  touch-action: none;
  pointer-events: none;
}

/*Add rows block*/
.add-rows {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 30px;
}
.add-rows__btn {
  padding: 5px;
  cursor: pointer;
}
.add-rows__input {
  padding: 5px;
  width: 100px;
}
.add-rows__text {
  font-size: 18px;
}


/*Responsive*/
@media (max-width: 480px) {
  .sheet__header {
    justify-content: space-around;
    padding: 6px 10px 0 4px;
  }
  .sheet__header-input {
    max-width: 70%;
  }
  .sheet__header-btns {
    flex-grow: 1;
  }
  .sheet__header-btn {
    width: 28px;
  }

}
